How to make your plugin BuddyPress 1.2 aware
WordPress load order makes it difficult to know if your plugin is loaded before or after BuddyPress.
If your plugin loads before BuddyPress it’s possible your plugin will call BuddyPress functions that aren’t yet loaded.
If your plugin loads after BuddyPress, you cannot attach it to any BuddyPress action to load it because they have all already fired.
BuddyPress introduces an action after all BuddyPress core code is loaded called ‘bp_init’
By checking for the existence of BuddyPress, and attaching your plugin to bp_init if BuddyPress isn’t already loaded, you can ensure that your plugins code is only loaded if BuddyPress is, and is loaded after all BuddyPress functions are available.
There are multiple ways this can be done but this is the simplest of the methods.
You must be logged in to reply to this topic.