/** * Decrease the total hidden topic count of a forum by one. * * @since 2.6.0 bbPress (r6036) * * @param int $forum_id The forum id. * * @uses bbp_is_topic() To get the topic id * @uses bbp_get_topic_forum_id() To get the topics forum id * @uses bbp_bump_forum_topic_count_hidden() To bump the forums hidden topic * count by -1 * * @return void */ function bbp_decrease_forum_topic_count_hidden($forum_id = 0) { // Bail early if no id is passed. if (empty($forum_id)) { return; } // If it's a topic, get the forum id. if (bbp_is_topic($forum_id)) { $forum_id = bbp_get_topic_forum_id($forum_id); } bbp_bump_forum_topic_count_hidden($forum_id, -1); }
/** * @covers ::bbp_bump_forum_topic_count_hidden */ public function test_bbp_bump_forum_topic_count_hidden() { $f = $this->factory->forum->create(); $count = bbp_get_forum_topic_count_hidden($f); $this->assertSame('0', $count); bbp_bump_forum_topic_count_hidden($f); $count = bbp_get_forum_topic_count_hidden($f); $this->assertSame('1', $count); }