Opened 10 years ago
Closed 10 years ago
#5843 closed defect (bug) (fixed)
WP_Screen may be null if remove_signups_from_user_query is called from within admin_init hook
Reported by: | pauldewouters | Owned by: | imath |
---|---|---|---|
Milestone: | 2.1 | Priority: | normal |
Severity: | normal | Version: | 2.0 |
Component: | Administration | Keywords: | commit |
Cc: | pauldewouters@… |
Description
Referencing this forum thread: http://buddypress.org/support/topic/conflict-with-my-plugin/#post-188636
The function remove_signups_from_user_query
in bp-members-admin.php
makes a call to get_current_screen()
This function will return null
if in the context of a function hooked to admin_init
In this case, a plugin I developed is running a WP_User_Query
on admin_init
so the pre_user_query
gets fired and this fires the remove_signups_from_user_query
function.
Method could check for admin_init
like so:
if ( doing_action( 'admin_init' ) || $this->users_page != get_current_screen()->id ) { return;}
Attachments (1)
Change History (8)
#1
@
10 years ago
- Cc pauldewouters@… added
- Component changed from Core to Administration
- Keywords dev-feedback added
- Version set to 2.0
#3
@
10 years ago
- Keywords reporter-feedback added
thanks for your feedback pauldewouters
Yes i think boonebgorges's way is better, as doing_action does not exist in WordPress before 3.9 and BuddyPress supports from 3.6 to latest version of WordPress.
Could you test 5843.patch to see if it solves the issue ?
Thanks for the report.
Checking for
doing_action( 'admin_init' )
seems overly specific to me. Let's just change our syntax a little bit:Will that work?