bbp_merge_topic_count

Fix counts on topic merge.

Description

bbp_merge_topic_count( (int) $destination_topic_id, (int) $source_topic_id, (int) $source_topic_forum_id ); 

When a topic is merged, update the counts of source and destination topic and their forums.

Parameters (3)

0. $destination_topic_id (int)
The destination topic id.
1. $source_topic_id (int)
The source topic id.
2. $source_topic_forum_id (int)
The source topic forum id.

Usage

  1. if ( !function_exists( 'bbp_merge_topic_count' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'bbpress/includes/topics/functions.php'; 
  3.  
  4. // The destination topic id. 
  5. $destination_topic_id = -1; 
  6.  
  7. // The source topic id. 
  8. $source_topic_id = -1; 
  9.  
  10. // The source topic forum id. 
  11. $source_topic_forum_id = -1; 
  12.  
  13. // NOTICE! Understand what this does before running. 
  14. $result = bbp_merge_topic_count($destination_topic_id, $source_topic_id, $source_topic_forum_id); 
  15.  

Defined (1)

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

/includes/topics/functions.php  
  1. function bbp_merge_topic_count( $destination_topic_id, $source_topic_id, $source_topic_forum_id ) { 
  2.  
  3. /** Source Topic **********************************************************/ 
  4.  
  5. // Forum Topic Counts 
  6. bbp_update_forum_topic_count( $source_topic_forum_id ); 
  7.  
  8. // Forum Reply Counts 
  9. bbp_update_forum_reply_count( $source_topic_forum_id ); 
  10.  
  11. /** Destination Topic *****************************************************/ 
  12.  
  13. // Topic Reply Counts 
  14. bbp_update_topic_reply_count( $destination_topic_id ); 
  15.  
  16. // Topic Hidden Reply Counts 
  17. bbp_update_topic_reply_count_hidden( $destination_topic_id ); 
  18.  
  19. // Topic Voice Counts 
  20. bbp_update_topic_voice_count( $destination_topic_id ); 
  21.  
  22. do_action( 'bbp_merge_topic_count', $destination_topic_id, $source_topic_id, $source_topic_forum_id );