bp_get_message_thread_total_and_unread_count

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

Description

(string) bp_get_message_thread_total_and_unread_count( (bool) $thread_id = false ); 

Returns (string)

Markup displaying the total and unread count for the thread.

Parameters (1)

0. $thread_id — Optional. (bool) => false
ID of the thread. Default: current thread ID.

Usage

  1. if ( !function_exists( 'bp_get_message_thread_total_and_unread_count' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddypress/bp-messages/bp-messages-template.php'; 
  3.  
  4. // Optional. ID of the thread. Default: current thread ID. 
  5. $thread_id = false; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = bp_get_message_thread_total_and_unread_count($thread_id); 
  9.  

Defined (1)

The function is defined in the following location(s).

/bp-messages/bp-messages-template.php  
  1. function bp_get_message_thread_total_and_unread_count( $thread_id = false ) { 
  2. if ( false === $thread_id ) { 
  3. $thread_id = bp_get_message_thread_id(); 
  4.  
  5. $total = bp_get_message_thread_total_count( $thread_id ); 
  6. $unread = bp_get_message_thread_unread_count( $thread_id ); 
  7.  
  8. return sprintf( 
  9. /** translators: 1: total number, 2: accessibility text: number of unread messages */ 
  10. '<span class="thread-count">(%1$s)</span> <span class="bp-screen-reader-text">%2$s</span>',  
  11. number_format_i18n( $total ),  
  12. sprintf( _n( '%d unread', '%d unread', $unread, buddypress ), number_format_i18n( $unread ) ) 
  13. );