BP_Messages_Thread::get_last_sender( int $thread_id )

Returns the userlink of the last sender in a message thread.


Parameters Parameters

$thread_id

(int) (Required) The message thread ID.


Top ↑

Return Return

(string|bool) The user link on success. Boolean false on failure.


Source Source

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

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

		$bp = buddypress();

		if ( ! $sender_id = $wpdb->get_var( $wpdb->prepare( "SELECT sender_id FROM {$bp->messages->table_name_messages} WHERE thread_id = %d GROUP BY sender_id ORDER BY date_sent LIMIT 1", $thread_id ) ) ) {
			return false;
		}

		return bp_core_get_userlink( $sender_id, true );
	}


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.