Notice from get_current_screen on all admin pages. #217

Closed
dancameron opened this Issue Aug 20, 2012 · 3 comments

Projects

None yet

2 participants

@dancameron

Check to make sure get_current_screen doesn't simply return null before objectifying it.

"Notice: Trying to get property of non-object in /.../wordpress/wp-content/plugins/posts-to-posts/core/url-query.php on line 27"

@scribu
Owner
scribu commented Aug 20, 2012

I can't reproduce the notice. This seems to me like some other code is whipping away the $current_screen global by mistake.

@dancameron

Okay, I'll test more and see if it's a conflict somewhere else.

@scribu
Owner
scribu commented Sep 9, 2012

A user in the support forums was able to shed light on the matter:

I have a helper function that is pulling a list of users (via WP's get_users), which is triggering P2P_URL_Query::user_query before get_current_screen is available. I'm working on excluding this function from the pre_user_query filter altogether, but I think it's worth being aware of: the pre_user_query filter is set up at init, but get_current_screen isn't available at init, according to http://codex.wordpress.org/Plugin_API/Action_Reference - it is available for any action after admin_init

http://wordpress.org/support/topic/plugin-posts-2-posts-get_current_screen-error-on-141-ajax-delete-not-working-on-142-alpha2?replies=2#post-3148257

@scribu scribu closed this in 6855881 Sep 9, 2012
@dbernar1 dbernar1 pushed a commit to dbernar1/wp-posts-to-posts that referenced this issue Oct 1, 2014
@scribu don't assume a current screen exists in P2P_URL_Query::user_query(). …
…fixes #217
5dd32dd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment