BP_Messages_Thread::user_is_sender( int $thread_id )
Determine if the logged-in user is a sender of any message in a thread.
Description
Parameters
- $thread_id
-
(Required) The message thread ID.
Return
(bool)
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 );
}
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.