BP_Messages_Message::get_message_sender( int $message_id )

Get the ID of the sender of a message.

Description

Parameters

$message_id

(int) (Required) ID of the message.

Return

(int|null) The ID of the sender if found, otherwise null.

Source

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

	public static function get_message_sender( $message_id ) {
		global $wpdb;

		$bp = buddypress();

		$query = $wpdb->get_var( $wpdb->prepare( "SELECT sender_id FROM {$bp->messages->table_name_messages} WHERE id = %d", $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.