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

Check whether a user is the sender of a message.

Description

Parameters

$user_id

(int) (Required) ID of the user.

$message_id

(int) (Required) ID of the message.

Return

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

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

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.