Notifications::mark_notifications_seen()

Description #

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

Source #

File: addons/notifications/notifications.php

	public function mark_notifications_seen() {
		if ( ! is_user_logged_in() || ! anspress_verify_nonce( 'mark_notifications_seen' ) ) {
			ap_ajax_json(
				array(
					'success'  => false,
					'snackbar' => array( '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'      => array( 'hide' => true ),
				'snackbar' => array( '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