Opened 10 years ago
Closed 10 years ago
#2529 closed defect (bug) (fixed)
Support Forums: PHP notice in User Moderation plugin
| Reported by: | SergeyBiryukov | Owned by: | coffee2code |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | Support Forums | Keywords: | has-patch commit |
| Cc: |
Description
- Log in as a flagged user that has a pending post.
- View that pending post.
- 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 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.
Attachments (1)
Change History (2)
Note:
See TracTickets
for help on using tickets.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
In 5038: