Example #1
0
 /**
  * @covers ::bbp_bump_topic_reply_count_hidden
  */
 public function test_bbp_bump_topic_reply_count_hidden()
 {
     $t = $this->factory->topic->create();
     $count = bbp_get_topic_reply_count_hidden($t);
     $this->assertSame('0', $count);
     $count = bbp_bump_topic_reply_count_hidden($t);
     $this->assertSame(1, $count);
     bbp_bump_topic_reply_count_hidden($t, 3);
     $count = bbp_get_topic_reply_count_hidden($t);
     $this->assertSame('4', $count);
 }
Example #2
0
/**
 * Decrease the total hidden reply count of a topic by one.
 *
 * @since 2.6.0 bbPress (r6036)
 *
 * @param int $topic_id The topic id.
 *
 * @uses bbp_is_reply() To check if the passed topic id is a reply
 * @uses bbp_get_reply_topic_id() To get the topic id
 * @uses bbp_bump_topic_reply_count_hidden() To bump topic hidden reply count
 *
 * @return void
 */
function bbp_decrease_topic_reply_count_hidden($topic_id = 0)
{
    // Bail early if no id is passed.
    if (empty($topic_id)) {
        return;
    }
    // If it's a reply, get the topic id.
    if (bbp_is_reply($topic_id)) {
        $topic_id = bbp_get_reply_topic_id($topic_id);
    }
    bbp_bump_topic_reply_count_hidden($topic_id, -1);
}