BP_Messages_Thread::get_messages_started( int $thread_id )

Get the time of when the message is started, could be the first message or the last deleted message of the current user

Description

Parameters

$thread_id

(int) (Required)

Source

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

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

		$bp = buddypress();
		$thread_id = (int) $thread_id;

		$last_deleted_timestamp = static::$last_deleted_message? static::$last_deleted_message->date_sent : '0000-00-00 00:00:00';

		$results = $wpdb->get_col( $sql = $wpdb->prepare(
			"SELECT date_sent FROM {$bp->messages->table_name_messages}
			WHERE thread_id = %d
			AND date_sent > %s
			ORDER BY date_sent ASC, id ASC
			LIMIT 1
		", $thread_id, $last_deleted_timestamp ) );

		return $results[0];
	}

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.