messages_get_message_thread_id( int $message_id )

Get the thread ID from a message ID.

Description

Parameters

$message_id

(int) (Required) ID of the message.

Return

(int) The ID of the thread if found, otherwise 0.

Source

File: bp-messages/bp-messages-functions.php

function messages_get_message_thread_id( $message_id = 0 ) {
	global $wpdb;

	$bp = buddypress();

	return (int) $wpdb->get_var( $wpdb->prepare( "SELECT thread_id FROM {$bp->messages->table_name_messages} WHERE id = %d", $message_id ) );
}

Changelog

Changelog
Version Description
BuddyPress 2.3.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.