bp_get_message_thread_total_count( int|bool $thread_id = false )

Get the current thread’s total message count.


Parameters Parameters

$thread_id

(int|bool) (Optional) ID of the thread. Defaults to current thread ID.

Default value: false


Top ↑

Return Return

(int)


Source Source

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

	function bp_get_message_thread_total_count( $thread_id = false ) {
		if ( false === $thread_id ) {
			$thread_id = bp_get_message_thread_id();
		}

		$thread_template = new BP_Messages_Thread_Template( $thread_id, 'ASC', array(
			'update_meta_cache' => false
		) );

		$count = 0;
		if ( ! empty( $thread_template->message_count ) ) {
			$count = intval( $thread_template->message_count );
		}

		/**
		 * Filters the current thread's total message count.
		 *
		 * @since 2.2.0
		 * @since 2.6.0 Added the `$thread_id` parameter.
		 *
		 * @param int $count     Current thread total message count.
		 * @param int $thread_id ID of the queried thread.
		 */
		return apply_filters( 'bp_get_message_thread_total_count', $count, $thread_id );
	}


Top ↑

Changelog Changelog

Changelog
Version Description
2.2.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.