bp_get_message_thread_total_and_unread_count( int|bool $thread_id = false )

Get markup for the current thread’s total and unread count.

Description

Parameters

$thread_id

(Optional) ID of the thread. Default: current thread ID.

Default value: false

Return

(string) Markup displaying the total and unread count for the thread.

Source

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

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

		$total  = bp_get_message_thread_total_count( $thread_id );
		$unread = bp_get_message_thread_unread_count( $thread_id );

		return sprintf(
			/* translators: 1: total number, 2: accessibility text: number of unread messages */
			'<span class="thread-count">(%1$s)</span> <span class="bp-screen-reader-text">%2$s</span>',
			number_format_i18n( $total ),
			sprintf( _n( '%d unread', '%d unread', $unread, 'buddyboss' ), number_format_i18n( $unread ) )
		);
	}

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.