BP_Messages_Thread::get_first_message( $thread_id )

Get a thread first message

Description

Parameters

$thread_id

(Required)

Return

(object|stdClass)

Source

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

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

		$bp = buddypress();

		$query            = $wpdb->prepare( "SELECT m.* FROM {$bp->messages->table_name_messages} m, {$bp->messages->table_name_meta}  mm WHERE m.id = mm.message_id AND m.thread_id = %d  AND ( mm.meta_key != 'group_message_group_joined' OR mm.meta_key != 'group_message_group_left' ) ORDER BY m.date_sent ASC, m.id ASC LIMIT 1", $thread_id );
		$messages         = $wpdb->get_results( $query );
		$blank_object     = new stdClass();
		$blank_object->id = 0;
		return $messages ? (object) $messages[0] : $blank_object;
	}

Changelog

Changelog
Version Description
BuddyBoss 1.2.9 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.