BP_Messages_Message::is_user_sender( int $user_id, int $message_id )

Check whether a user is the sender of a message.


Parameters Parameters

$user_id

(int) (Required) ID of the user.

$message_id

(int) (Required) ID of the message.


Top ↑

Return Return

(int|null) Returns the ID of the message if the user is the sender, otherwise null.


Source Source

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

	public static function is_user_sender( $user_id, $message_id ) {
		global $wpdb;

		$bp = buddypress();

		$query = $wpdb->get_var( $wpdb->prepare( "SELECT id FROM {$bp->messages->table_name_messages} WHERE sender_id = %d AND id = %d", $user_id, $message_id ) );

		return is_numeric( $query ) ? (int) $query : $query;
	}


Top ↑

User Contributed Notes User Contributed Notes

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