Alert: This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.
BuddyPress::constants()
Bootstrap constants.
Description Description
Source Source
File: class-buddypress.php
private function constants() {
// Place your custom code (actions/filters) in a file called
// '/plugins/bp-custom.php' and it will be loaded before anything else.
if ( file_exists( WP_PLUGIN_DIR . '/bp-custom.php' ) ) {
require( WP_PLUGIN_DIR . '/bp-custom.php' );
}
// Path and URL
if ( ! defined( 'BP_PLUGIN_DIR' ) ) {
define( 'BP_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
}
if ( ! defined( 'BP_PLUGIN_URL' ) ) {
define( 'BP_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
}
// Legacy forum constant - supported for compatibility with bbPress 2.
if ( ! defined( 'BP_FORUMS_PARENT_FORUM_ID' ) ) {
define( 'BP_FORUMS_PARENT_FORUM_ID', 1 );
}
// Legacy forum constant - supported for compatibility with bbPress 2.
if ( ! defined( 'BP_FORUMS_SLUG' ) ) {
define( 'BP_FORUMS_SLUG', 'forums' );
}
// Only applicable to those running trunk
if ( ! defined( 'BP_SOURCE_SUBDIRECTORY' ) ) {
define( 'BP_SOURCE_SUBDIRECTORY', '' );
}
// Define on which blog ID BuddyPress should run
if ( ! defined( 'BP_ROOT_BLOG' ) ) {
// Default to use current blog ID
// Fulfills non-network installs and BP_ENABLE_MULTIBLOG installs
$root_blog_id = get_current_blog_id();
// Multisite check
if ( is_multisite() ) {
// Multiblog isn't enabled
if ( ! defined( 'BP_ENABLE_MULTIBLOG' ) || ( defined( 'BP_ENABLE_MULTIBLOG' ) && (int) constant( 'BP_ENABLE_MULTIBLOG' ) === 0 ) ) {
// Check to see if BP is network-activated
// We're not using is_plugin_active_for_network() b/c you need to include the
// /wp-admin/includes/plugin.php file in order to use that function.
// get network-activated plugins
$plugins = get_site_option( 'active_sitewide_plugins');
// basename
$basename = basename( constant( 'BP_PLUGIN_DIR' ) ) . '/bp-loader.php';
// plugin is network-activated; use main site ID instead
if ( isset( $plugins[ $basename ] ) ) {
$current_site = get_current_site();
$root_blog_id = $current_site->blog_id;
}
}
}
define( 'BP_ROOT_BLOG', $root_blog_id );
}
// The search slug has to be defined nice and early because of the way
// search requests are loaded
//
// @todo Make this better
if ( ! defined( 'BP_SEARCH_SLUG' ) ) {
define( 'BP_SEARCH_SLUG', 'search' );
}
}
Changelog Changelog
| Version | Description |
|---|---|
| 1.6.0 | Introduced. |