BP_Messages_Thread::get_last_message( $thread_id )
Get a thread’s last message
Description
Parameters
- $thread_id
-
(Required)
Return
(object|null)
Source
File: bp-messages/classes/class-bp-messages-thread.php
public static function get_last_message( $thread_id ) { global $wpdb; $bp = buddypress(); $messages = $wpdb->get_results( $wpdb->prepare( " SELECT * FROM {$bp->messages->table_name_messages} WHERE thread_id = %d ORDER BY date_sent DESC, id DESC LIMIT 1 ", $thread_id ) ); return $messages? (object) $messages[0] : null; }
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.