BP_Messages_Thread::is_thread_recipient( int $thread_id, mix $user_id = null )

Check if the current user is in the thread’s active recipient list

Description

Parameters

$thread_id

(int) (Required)

$user_id

(mix) (Optional)

Default value: null

Source

File: bp-messages/classes/class-bp-messages-thread.php

	public static function is_thread_recipient( $thread_id = 0, $user_id = null ) {
		if ( ! $user_id = $user_id ?: bp_loggedin_user_id() ) {
			return true;
		}

		$recipients = self::get_recipients_for_thread( $thread_id );
		$active_recipients = array_filter( $recipients, function ( $recipient ) {
			return ! $recipient->is_deleted;
		});

		return in_array( $user_id, wp_list_pluck( $active_recipients, 'user_id' ));
	}

Changelog

Changelog
Version Description
BuddyBoss 1.0.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.