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

Fix counts on topic merge

Description

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

Parameters

$destination_topic_id

(Required) Destination topic id

$source_topic_id

(Required) Source topic id

$source_topic_forum

(Required) Source topic's forum id

Source

File: bp-forums/topics/functions.php

1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
function bbp_merge_topic_count( $destination_topic_id, $source_topic_id, $source_topic_forum_id ) {
 
    /** Source Topic **********************************************************/
 
    // Forum Topic Counts
    bbp_update_forum_topic_count( $source_topic_forum_id );
 
    // Forum Reply Counts
    bbp_update_forum_reply_count( $source_topic_forum_id );
 
    /** Destination Topic *****************************************************/
 
    // Topic Reply Counts
    bbp_update_topic_reply_count( $destination_topic_id );
 
    // Topic Hidden Reply Counts
    bbp_update_topic_reply_count_hidden( $destination_topic_id );
 
    // Topic Members Counts
    bbp_update_topic_voice_count( $destination_topic_id );
 
    do_action( 'bbp_merge_topic_count', $destination_topic_id, $source_topic_id, $source_topic_forum_id );
}

Changelog

Changelog
Version Description
bbPress (r2756) Introduced.

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.