Skip to:
Content
Pages
Categories
Search
Top
Bottom

Re: Call to undefined function bp_core_add_subnav_item()


Burt Adsit
Participant

@burtadsit

Sounds like your plugin is loading before bp is loaded. If the core fns aren’t there then bp is probably loading after yours. When you do the upgrade it now has a different sequence in the list of sitewide plugins.

I think jeffsayre put some checking code into the bp skel component. I don’t know if it’s been released yet. In case it hasn’t this is what it looks like:

/**
* oci_load_buddypress()
*
* Checks to see of bp is active. Attempts to load it if it isn't.
*
* @return true if bp is installed and activated
*/
function oci_load_buddypress() {
if ( function_exists( 'bp_core_setup_globals' ) )
return true;

/* Get the list of active sitewide plugins */
$active_sitewide_plugins = maybe_unserialize( get_site_option( 'active_sitewide_plugins' ) );

if ( !isset( $active_sidewide_plugins['buddypress/bp-loader.php'] ) )
return false;

if ( isset( $active_sidewide_plugins['buddypress/bp-loader.php'] ) &&
!function_exists( 'bp_core_setup_globals' ) ) {
require_once( WP_PLUGIN_DIR . '/buddypress/bp-loader.php' );
return true;
}

return false;
}

If this fn returns true then either bp is loaded, bp wasn’t loaded and it loaded it or false bp couldn’t be loaded.

True is your plugin can continue, false is do some kind of graceful exit.

Skip to toolbar