BP_Messages_Thread::get_last_sender( int $thread_id )

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

Description

Parameters

$thread_id

(int) (Required) The message thread ID.

Return

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

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

Changelog

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.