BP_REST_Messages_Endpoint::bp_rest_post_dispatch( WP_HTTP_Response $result, WP_REST_Server $server, WP_REST_Request $request )

Add Global header for the unread message count.

Description

Parameters

$result

(Required) Rest response.

$server

(Required) Rest Server.

$request

(Required) Rest request.

Return

(WP_HTTP_Response)

Source

File: bp-messages/classes/class-bp-rest-messages-endpoint.php

	public function bp_rest_post_dispatch( $result, $server, $request ) {
		if ( function_exists( 'messages_get_unread_count' ) ) {
			$result->header( 'bbp-unread-messages', (int) messages_get_unread_count( bp_loggedin_user_id() ) );
		}

		return $result;
	}

Questions?

We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.