[buddypress-trac] [BuddyPress] #3625: Core functions should not hook to bp_init with default priority
buddypress-trac at lists.automattic.com
buddypress-trac at lists.automattic.com
Mon Sep 26 17:41:25 UTC 2011
#3625: Core functions should not hook to bp_init with default priority
--------------------------+-------------------------------------
Reporter: boonebgorges | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: 1.6
Component: Core | Version: 1.5
Severity: normal | Keywords: has-patch needs-testing
--------------------------+-------------------------------------
I had a good discussion on ticket #3622 about the bp_init hook and
plugins. Conceptually, I think that the idea behind bp_init is to let
plugins attach certain actions to a point in the load order when they can
be sure that BP's core functionality has been fully loaded. This mostly
works - bp_setup_globals, bp_setup_nav, and other initialization hooks all
happen before bp_init priority 10. However, there are a few important
places in BP where we use priority 10, with the result that if a plugin
happens to be loaded by WordPress *before* BP is, those hooks could fail
to find the corresponding action. To wit:
bp_core_load_admin_bar_css()
bp_core_load_buddybar_css()
bp_core_admin_menu_init() (initializes the admin menu loader)
bp_core_add_ajax_hook() (creates the wp_ajax_ hooks on the front-end that
WP has by default on the back end)
bp_core_wpsignup_redirect() (redirects users away from wp-signup.php when
BP is installed)
There are also some places in the friends component where we hook to
bp_init, but IMO that's not as crucial, since our optional components
essentially operate like plugins anyway.
I propose that all of the above function be moved from bp_init priority 10
to 8 or 9. This will obviously need some thorough testing (though I'm
pretty certain that making these particular functions fire a bit *earlier*
is not going to hurt anything). I'll post a patch.
--
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/3625>
BuddyPress <http://buddypress.org/>
BuddyPress
More information about the buddypress-trac
mailing list