bbp_bump_topic_reply_count

Bump the total reply count of a topic.

Description

(int) bbp_bump_topic_reply_count( (int) $topic_id = 0, (int) $difference = 1 ); 

Returns (int)

Forum reply count

Parameters (2)

0. $topic_id — Optional. (int)
Forum id.
1. $difference — Optional. (int) => 1
Default 1

Usage

  1. if ( !function_exists( 'bbp_bump_topic_reply_count' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'bbpress/includes/topics/functions.php'; 
  3.  
  4. // Optional. Forum id. 
  5. $topic_id = -1; 
  6.  
  7. // Optional. Default 1 
  8. $difference = 1; 
  9.  
  10. // NOTICE! Understand what this does before running. 
  11. $result = bbp_bump_topic_reply_count($topic_id, $difference); 
  12.  

Defined (1)

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

/includes/topics/functions.php  
  1. function bbp_bump_topic_reply_count( $topic_id = 0, $difference = 1 ) { 
  2.  
  3. // Get counts 
  4. $topic_id = bbp_get_topic_id( $topic_id ); 
  5. $reply_count = bbp_get_topic_reply_count( $topic_id, true ); 
  6. $new_count = (int) $reply_count + (int) $difference; 
  7.  
  8. // Update this topic id's reply count 
  9. update_post_meta( $topic_id, '_bbp_reply_count', (int) $new_count ); 
  10.  
  11. return (int) apply_filters( 'bbp_bump_topic_reply_count', (int) $new_count, $topic_id, (int) $difference );