#3611 closed defect (bug) (fixed)
Wrong Output on Hidden Topic Counting Function
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Milestone: | 2.6.14 | Priority: | normal |
| Severity: | normal | Version: | 2.0 |
| Component: | Component - Forums | Keywords: | has-patch has-unit-tests |
| Cc: |
Description
I was reviewing this test case
<?php $count = bbp_get_forum_topic_count_hidden( $f, true ); $this->assertSame( 1, $count );
Which happens to be failing.
After inspection of the function bbp_get_forum_topic_count_hidden
I've noted that the metakey _bbp_topic_reply_count_hidden is not being used anywhere, hence its never initialized in the $topic_total_count @ bbp_bump_forum_topic_count_hidden
This can be something legacy, so essentially judging by the code, I think that _bbp_topic_reply_count_hidden was substituted by _bbp_total_topic_count_hidden which make a lot of sense because the condition is
<?php $meta_key = empty( $total_count ) ? '_bbp_topic_count_hidden' : '_bbp_total_topic_count_hidden';
Which happens to be checking if total_count is true, then its false, hence return the "total count" metakey.
Also, with this patch, the current available Unit Test passes.
Also, given that total_count is a bool, why not use the not operator instead of empty. It's the same, but using the later, to my eyes looks a little less intuitive.
Attachments (1)
Change History (7)
This ticket was mentioned in PR #19 on bbpress/bbPress by @SirLouen.
16 months ago
#1
Trac Ticket, more info there:
https://bbpress.trac.wordpress.org/ticket/3611
This ticket was mentioned in PR #20 on bbpress/bbPress by @SirLouen.
16 months ago
#2
#3
@
8 months ago
- Milestone changed from Awaiting Review to 2.6.14
- Owner set to johnjamesjacoby
- Status changed from new to assigned
- Version changed from trunk to 2.0
@johnjamesjacoby commented on PR #20:
4 months ago
#6
Fixed via: https://bbpress.trac.wordpress.org/changeset/7330
Thank you!
Fix for Hiddent Topic Count