bp_dtheme_ajax_message_markunread()

Mark a private message as unread in your inbox via a POST request.


Description Description


Return Return

(mixed) String on error, void on success


Top ↑

Source Source

File: bp-themes/bp-default/_inc/ajax.php

function bp_dtheme_ajax_message_markunread() {
	// Bail if not a POST action
	if ( 'POST' !== strtoupper( $_SERVER['REQUEST_METHOD'] ) )
		return;

	$nonce_check = isset( $_POST['nonce'] ) && wp_verify_nonce( wp_unslash( $_POST['nonce'] ), 'bp_messages_mark_messages_unread' );

	if ( ! $nonce_check || ! isset( $_POST['thread_ids'] ) ) {
		echo "-1<div id='message' class='error'><p>" . __( 'There was a problem marking messages as unread.', 'buddypress' ) . '</p></div>';

	} else {
		$thread_ids = explode( ',', $_POST['thread_ids'] );

		for ( $i = 0, $count = count( $thread_ids ); $i < $count; ++$i ) {
			BP_Messages_Thread::mark_as_unread( (int) $thread_ids[$i] );
		}
	}

	exit;
}

Top ↑

Changelog Changelog

Changelog
Version Description
BuddyPress (1.2) Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.