BP_REST_Messages_Endpoint::get_current_user_permissions( object $recipient, WP_REST_Request $request )

Get current user’s permission.

Description

Parameters

$recipient

(Required) The recipient object.

$request

(Required) Full details about the request.

Return

(array) Get current user permission.

Source

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

	public function get_current_user_permissions( $recipient, $request ) {

		$retval = array(
			'unread'          => true,
			'delete_messages' => true,
			'delete_thread'   => bp_user_can(
				$recipient->user_id,
				'bp_moderate',
				array(
					'site_id' => bp_get_root_blog_id(),
				)
			),
		);

		if ( isset( $recipient->is_hidden ) ) {
			$retval['hide_thread'] = true;
		}

		return $retval;
	}

Changelog

Changelog
Version Description
0.1.0 Introduced.

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.