bbp_split_topic_count( int $from_reply_id, int $source_topic_id, int $destination_topic_id )

Fix counts on topic split

Description

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

Parameters

$from_reply_id

(Required) From reply id

$source_topic_id

(Required) Source topic id

$destination_topic_id

(Required) Destination topic id

Source

File: bp-forums/topics/functions.php

1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
function bbp_split_topic_count( $from_reply_id, $source_topic_id, $destination_topic_id ) {
 
    // Forum Topic Counts
    bbp_update_forum_topic_count( bbp_get_topic_forum_id( $destination_topic_id ) );
 
    // Forum Reply Counts
    bbp_update_forum_reply_count( bbp_get_topic_forum_id( $destination_topic_id ) );
 
    // Topic Reply Counts
    bbp_update_topic_reply_count( $source_topic_id      );
    bbp_update_topic_reply_count( $destination_topic_id );
 
    // Topic Hidden Reply Counts
    bbp_update_topic_reply_count_hidden( $source_topic_id      );
    bbp_update_topic_reply_count_hidden( $destination_topic_id );
 
    // Topic Members Counts
    bbp_update_topic_voice_count( $source_topic_id      );
    bbp_update_topic_voice_count( $destination_topic_id );
 
    do_action( 'bbp_split_topic_count', $from_reply_id, $source_topic_id, $destination_topic_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.