BP_Messages_Thread::get_last_sender( int $thread_id )

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

Description

Parameters

$thread_id

(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

1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
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.