[wp-meta] [Making WordPress.org] #2529: Support Forums: PHP notice in User Moderation plugin
Making WordPress.org
noreply at wordpress.org
Wed Feb 22 23:07:02 UTC 2017
#2529: Support Forums: PHP notice in User Moderation plugin
----------------------------+------------------------------
Reporter: SergeyBiryukov | Owner:
Type: defect | Status: new
Priority: normal | Milestone:
Component: Support Forums | Keywords: has-patch commit
----------------------------+------------------------------
1. Log in as a flagged user that has a pending post.
2. View that pending post.
3. You'll get two PHP notices:
{{{
Notice: Trying to get property of non-object in wp-includes/class-wp-
query.php on line 3894
Notice: Trying to get property of non-object in wp-includes/class-wp-
query.php on line 3894
}}}
`Plugin::posts_where()` calls `bbp_is_single_forum()` and
`bbp_is_single_topic()`, and they both call `is_singular()`. The first
call happens before the `wp` action runs, when conditional tags are not
properly set up yet. See #wp29660, specifically
[https://core.trac.wordpress.org/ticket/29660#comment:21 comment 21].
Adding `did_action( 'wp' )` to the condition fixes the issue and still
allows flagged users to see their pending posts, which is the purpose of
this code.
--
Ticket URL: <https://meta.trac.wordpress.org/ticket/2529>
Making WordPress.org <https://meta.trac.wordpress.org/>
Making WordPress.org
More information about the wp-meta
mailing list