cuny-academic-commons / bp-event-organiser

Allows Event Organiser plugin events to be assigned to BuddyPress groups and generates a group calendar page for each group
GNU General Public License v2.0
3 stars 1 forks source link

Various stuff breaks when WP's native `get_current_screen()` is present #35

Closed boonebgorges closed 9 years ago

boonebgorges commented 9 years ago

In wp-frontend-admin-screen.php, you provide a version of get_current_screen() that fakes wp-admin's screen functionality. But it's only used if WP's get_current_screen() does not exist. A fair number of plugins bootstrap wp-admin on the front end - WP-API is one of them, which is what's leading to the bug on my install. When this happens, none of the screen-faking magic happens.

A couple possibilities. One: when abstracting/faking the current screen, put it into the $current_screen global. Then the get_current_screen() function can be used in its original form. Two: Don't reference get_current_screen()->id when, eg, populating the pagenow js variables. (In my case, it's the latter bit that's causing direct problems, so perhaps it could be papered over in this way.)

r-a-y commented 9 years ago

Thanks for the report! Will take a look.

r-a-y commented 9 years ago

Decided to go with your option 2 and replaced references to get_current_screen()->id with the already-passed post type. After more investigating, get_current_screen() isn't really necessary for the edit post admin interface to function so I removed it.