AnsPress_Notification_Hook::mark_notifications_seen()

Description #

Ajax callback for marking all notification of current user as seen.

Source #

File: addons/free/notification.php

	public static function mark_notifications_seen() {
		if ( ! is_user_logged_in() || ! ap_verify_nonce( 'mark_notifications_seen' ) ) {
			ap_ajax_json( array(
				'success' => false,
				'snackbar' => [ 'message' => __( 'There was a problem processing your request', 'anspress-question-answer' ) ],
			) );
		}

		// Mark all notifications as seen.
		ap_set_notifications_as_seen( get_current_user_id() );

		ap_ajax_json( array(
			'success'  => true,
			'btn'      => [ 'hide'    => true ],
			'snackbar' => [ 'message' => __( 'Successfully updated all notifications', 'anspress-question-answer' ) ],
			'cb'       => 'notificationAllRead',
		) );

		wp_die();
	}

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Add your comment