bbp_approved_unapproved_topic_update_forum_reply_count( int $topic_id )
Update forum reply counts when a topic is approved or unapproved.
Description Description
Parameters Parameters
- $topic_id
-
(Required) The topic id.
Return Return
(void)
Source Source
File: includes/forums/functions.php
function bbp_approved_unapproved_topic_update_forum_reply_count( $topic_id = 0 ) {
// Bail early if we don't have a topic id.
if ( empty( $topic_id ) ) {
return;
}
// Get the topic's replies.
$count = bbp_get_public_child_count( $topic_id, bbp_get_reply_post_type() );
// If we're unapproving, set count to negative.
if ( 'bbp_unapproved_topic' === current_filter() ) {
$count = -$count;
}
// Bump up or down
bbp_bump_forum_reply_count( bbp_get_topic_forum_id( $topic_id ), $count );
}
Changelog Changelog
| Version | Description |
|---|---|
| 2.6.0 | Introduced. |