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

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


Parameters Parameters

$thread_id

(int) (Required) The message thread ID.

$user_id

(int) (Required) The user ID.


Top ↑

Return Return

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


Source 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;
		}
	}


Top ↑

Changelog Changelog

Changelog
Version Description
1.0.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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