Opened 9 years ago
Last modified 8 years ago
#2931 new defect (bug)
Various conditional tags returning `true` when they should be `false`
Reported by: | netweb | Owned by: | |
---|---|---|---|
Milestone: | 2.7 | Priority: | normal |
Severity: | normal | Version: | 2.0 |
Component: | General - Performance | Keywords: | has-patch 2nd-opinion |
Cc: |
Description (last modified by )
Each of the cases below return true
and should not:
Forum root: http://src.wordpress-develop.dev/forums/
bbp_is_forum_open()
bbp_is_forum_public()
bbp_is_reply_anonymous()
bbp_is_topic_anonymous()
bbp_is_reply_published()
bbp_is_topic_published()
bbp_is_group_forums_active()
<- This wastrue
after deactivating BP
Single Forum: http://src.wordpress-develop.dev/forums/forum/bbp-public-forum/
bbp_is_reply_published()
bbp_is_topic_published()
bbp_is_group_forums_active()
<- This wastrue
after deactivating BP
BuddyPress Group Single Forum: http://src.wordpress-develop.dev/groups/bp-public-group/forum/
bbp_is_reply_anonymous()
bbp_is_topic_anonymous()
bbp_is_reply_published()
bbp_is_topic_published()
bbp_is_group_forums_active()
<- This wastrue
after deactivating BP
BuddyPress Group Single Topic: http://src.wordpress-develop.dev/groups/bp-public-group/forum/topic/test-topic/
bbp_is_reply_anonymous()
bbp_is_reply_published()
bbp_is_topic_published()
bbp_is_group_forums_active()
<- This wastrue
after deactivating BP
Single Topic: http://src.wordpress-develop.dev/forums/topic/bbp-public-topic/
bbp_is_reply_published()
bbp_is_group_forums_active()
<- This wastrue
after deactivating BP
Fun Fact: My entire dev site doesn't have any replies whatsoever
Attachments (1)
Change History (8)
#1
@
9 years ago
- Description modified (diff)
- Summary changed from `bbp_is_reply_published()` returns `true` on topics without any replies to `bbp_is_reply_published()` returns `true` on forums and topics without any replies
#2
@
9 years ago
- Description modified (diff)
- Summary changed from `bbp_is_reply_published()` returns `true` on forums and topics without any replies to Various conditional tags returning `true` when they should be `false`
#6
@
8 years ago
- Keywords has-patch added; needs-patch removed
- Milestone changed from Awaiting Review to 2.6
Attached patch should fix things up.
One thing that stood out. The bbp_get_topic|reply_status
functions were returning a publish
status when the topic/reply id was 0
. This is because when using theme compat, we're setting a dummy post with a post id of 0
and a status of publish
. So, a get_post_status()
check on an empty topic/reply id is returning as publish
and making bbPress sad.
I'm wondering if we should be more deliberate of using the default of -9999
for the dummy post id to avoid conflicts elsewhere.
#7
@
8 years ago
- Component changed from Component - Replies to General - Performance
- Keywords 2nd-opinion added
- Milestone changed from 2.6 to 2.7
- Version set to 2.0
A few thoughts, then I'm going to punt this to 2.7 to clear out the 2.6 milestone:
- There are actually _many_ more functions that exhibit this type of behavior
- All template functions assume you're using them within the appropriate context
- Calling template functions out of context will yield inconsistent results
- Also see
bbp_open_forum()
for another example, where an empty$forum_id
doesn't bail early
If we want to continue, I think there is more to do, and I recommend we repurpose this ticket to reflect that.
I'm also moving this to to the "General - Performance" component, since a global bail-early for empty IDs is likely to bypass a bunch of processing across the board.
Possibly related #2727