BP_Messages_Thread::check_access( int $thread_id, int $user_id )

Checks whether a user is a part of a message thread discussion.

Description

Parameters

$thread_id

(Required) The message thread ID.

$user_id

(Required) The user ID.

Return

(int|null) The recorded recipient ID on success, null on failure.

Source

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

	public static function check_access( $thread_id, $user_id = 0 ) {

		if ( empty( $user_id ) ) {
			$user_id = bp_loggedin_user_id();
		}

		$recipients = self::get_recipients_for_thread( $thread_id );

		if ( isset( $recipients[ $user_id ] ) && 0 == $recipients[ $user_id ]->is_deleted ) {
			return $recipients[ $user_id ]->id;
		} else {
			return null;
		}
	}

Changelog

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