Skip to:
Content
Pages
Categories
Search
Top
Bottom

How to make your plugin BuddyPress 1.2 aware

  • @johnjamesjacoby

    Keymaster

    Problems:

    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.

    Solution:

    http://codex.buddypress.org/how-to-guides/make-your-plugin-buddypress-aware-v1-2/

    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.

  • The topic ‘How to make your plugin BuddyPress 1.2 aware’ is closed to new replies.
Skip to toolbar