// Get topics of forum
if ( empty( $topic_count ) )
$topic_count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(ID) FROM {$wpdb->posts} WHERE post_parent = %d AND post_status IN ( '" . join( '','', array( bbp_get_trash_status_id(), bbp_get_spam_status_id() ) ) . "') AND post_type = '%s';", $forum_id, bbp_get_topic_post_type() ) );
// Update the count
update_post_meta( $forum_id, '_bbp_topic_count_hidden', (int) $topic_count );
}
return apply_filters( 'bbp_update_forum_topic_count_hidden', (int) $topic_count, $forum_id );
}
/**
* Adjust the total reply count of a forum
*
* @since bbPress (r2464)
*
* @param int $forum_id Optional. Forum id or topic id. It is checked whether it
* is a topic or a forum. If it's a topic, its parent,
* i.e. the forum is automatically retrieved.