BP_Messages_Thread::user_is_sender( int $thread_id )

Determine if the logged-in user is a sender of any message in a thread.


Parameters Parameters

$thread_id

(int) (Required) The message thread ID.


Top ↑

Return Return

(bool)


Source Source

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

	public static function user_is_sender( $thread_id ) {
		global $wpdb;

		$bp = buddypress();

		$sender_ids = $wpdb->get_col( $wpdb->prepare( "SELECT sender_id FROM {$bp->messages->table_name_messages} WHERE thread_id = %d", $thread_id ) );

		if ( empty( $sender_ids ) ) {
			return false;
		}

		return in_array( bp_loggedin_user_id(), $sender_ids );
	}


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.