bbp_get_forum_reply_count

Return total post count of a forum.

Description

(int) bbp_get_forum_reply_count( (int) $forum_id = 0, (constant) $total_count = true, (bool) $integer = false ); 

Returns (int)

Forum reply count

Parameters (3)

0. $forum_id — Optional. (int)
Forum id
1. $total_count — Optional. (constant) => true
To get the total count or normal count?
2. $integer — Optional. (bool) => false
Whether or not to format the result

Usage

  1. if ( !function_exists( 'bbp_get_forum_reply_count' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'bbpress/includes/forums/template.php'; 
  3.  
  4. // Optional. Forum id 
  5. $forum_id = -1; 
  6.  
  7. // Optional. To get the total count or normal 
  8. // count? 
  9. $total_count = true; 
  10.  
  11. // Optional. Whether or not to format the result 
  12. $integer = false; 
  13.  
  14. // NOTICE! Understand what this does before running. 
  15. $result = bbp_get_forum_reply_count($forum_id, $total_count, $integer); 
  16.  

Defined (1)

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

/includes/forums/template.php  
  1. function bbp_get_forum_reply_count( $forum_id = 0, $total_count = true, $integer = false ) { 
  2. $forum_id = bbp_get_forum_id( $forum_id ); 
  3. $meta_key = empty( $total_count ) ? '_bbp_reply_count' : '_bbp_total_reply_count'; 
  4. $replies = (int) get_post_meta( $forum_id, $meta_key, true ); 
  5. $filter = ( true === $integer ) ? 'bbp_get_forum_reply_count_int' : 'bbp_get_forum_reply_count'; 
  6.  
  7. return apply_filters( $filter, $replies, $forum_id );