Plugin Authors: Important BuddyPress 1.2.5 News you need to know
-
In BuddyPress 1.2.5, another attempt was made to provide us all with built in hooks we can use to tap into BuddyPress’s core loading and setup processes.
These changes appear in bp-loaded.php and bp-core.php. There are now several different actions you can attach your plugin to, depending on when exactly you need to load your code.
The main action that gets this ball rolling is called ‘bp_loaded’. It is loaded very late attached to the WordPress action ‘plugins_loaded’, at priority 20. This is to allow any old plugins that used plugins loaded the opportunity to continue to load themselves ahead of BuddyPress.
You can choose to attach your functions early or late to ‘bp_loaded’ depending on your needs.
The first action attached to ‘bp_loaded’ is ‘bp_include’. This action is intended to be used for including your files, and to attach your functions to the actions that follow it.
Next up is ‘bp_setup_root_components’ which components should use if they are adding a BuddyPress root component; I.E. ‘domain.com/groups’
Next is ‘bp_setup_globals’ which is where components actually set up all of their global properties into the $bp global.
Next is ‘bp_setup_nav’ which is how you attach your components navigation to the BuddyBar and the tabbed navigation area when viewing your profile.
Next is ‘bp_setup_widgets’ which is how you tell BuddyPress that your special component comes with extra widgets.
Lastly, is our old friend ‘bp_init’. It was moved to the end of the order so that your plugins have a place to modify existing BuddyPress core components after they have completely initialized themselves and hooked into all of the previous actions.
Plugin authors, this means that you will want to pay attention to when your plugins load which pieces of code, and make sure that you are not ahead or behind the curve.
This also means that if you’re using a heavily modified BuddyPress installation, it’s possible non-compliant plugins might not behave, so as always take extreme care when upgrading your BuddyPress installation and be sure to back everything up before giving it a go.
Thanks everyone and please report any issues you have pertaining to these new actions/hooks here so I can keep track of anything major.
- The topic ‘Plugin Authors: Important BuddyPress 1.2.5 News you need to know’ is closed to new replies.