本文整理汇总了PHP中bp_is_network_activated函数的典型用法代码示例。如果您正苦于以下问题:PHP bp_is_network_activated函数的具体用法?PHP bp_is_network_activated怎么用?PHP bp_is_network_activated使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了bp_is_network_activated函数的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: includes
/**
* Includes.
*/
public function includes($includes = array())
{
/** Backwards-compatibility ******************************************/
// template stack for BP < 1.7
if (!class_exists('BP_Theme_Compat')) {
require $this->path . '/backpat/template-stack.php';
}
// activity scope for BP < 2.2
if (!class_exists('BP_Activity_Query')) {
require $this->path . '/backpat/activity-scope.php';
}
/** Core **************************************************************/
require $this->path . '/bp-follow-classes.php';
require $this->path . '/bp-follow-functions.php';
// users module
if (true === (bool) apply_filters('bp_follow_enable_users', true)) {
require $this->path . '/users/screens.php';
require $this->path . '/users/actions.php';
require $this->path . '/users/hooks.php';
require $this->path . '/users/template.php';
require $this->path . '/users/notifications.php';
require $this->path . '/users/widgets.php';
}
// blogs module - on multisite and BP 2.0+ only
if (function_exists('bp_add_option') && bp_is_active('blogs') && is_multisite() && bp_is_network_activated() && apply_filters('bp_follow_enable_blogs', true)) {
require $this->path . '/modules/blogs.php';
}
// updater
if (defined('WP_NETWORK_ADMIN')) {
require $this->path . '/bp-follow-updater.php';
}
}
示例2: admin_menus
/**
* Create the All Users / Profile > Edit Profile and All Users Signups submenus.
*
* @since 2.0.0
*
*/
public function admin_menus()
{
// Setup the hooks array.
$hooks = array();
// Manage user's profile.
$hooks['user'] = $this->user_page = add_submenu_page($this->user_profile . '.php', __('Edit Profile', 'buddypress'), __('Edit Profile', 'buddypress'), 'read', 'bp-profile-edit', array($this, 'user_admin'));
// Only show sign-ups where they belong.
if (!bp_is_network_activated() && !is_network_admin() || is_network_admin() && bp_is_network_activated()) {
// Manage signups.
$hooks['signups'] = $this->signups_page = add_users_page(__('Manage Signups', 'buddypress'), __('Manage Signups', 'buddypress'), $this->capability, 'bp-signups', array($this, 'signups_admin'));
}
$edit_page = 'user-edit';
$profile_page = 'profile';
$this->users_page = 'users';
// Self profile check is needed for this pages.
$page_head = array($edit_page . '.php', $profile_page . '.php', $this->user_page, $this->users_page . '.php');
// Append '-network' to each array item if in network admin.
if (is_network_admin()) {
$edit_page .= '-network';
$profile_page .= '-network';
$this->user_page .= '-network';
$this->users_page .= '-network';
$this->signups_page .= '-network';
}
// Setup the screen ID's.
$this->screen_id = array($edit_page, $this->user_page, $profile_page);
// Loop through new hooks and add method actions.
foreach ($hooks as $key => $hook) {
add_action("load-{$hook}", array($this, $key . '_admin_load'));
}
// Add the profile_admin_head method to proper admin_head actions.
foreach ($page_head as $head) {
add_action("admin_head-{$head}", array($this, 'profile_admin_head'));
}
}
示例3: bp_is_multiblog_mode
/**
* Are we running multiblog mode?
*
* Note that BP_ENABLE_MULTIBLOG is different from (but dependent on) WordPress
* Multisite. "Multiblog" is BuddyPress setup that allows BuddyPress components
* to be viewed on every blog on the network, each with their own settings.
*
* Thus, instead of having all 'boonebgorges' links go to
* http://example.com/members/boonebgorges
* on the root blog, each blog will have its own version of the same content, eg
* http://site2.example.com/members/boonebgorges (for subdomains)
* http://example.com/site2/members/boonebgorges (for subdirectories)
*
* Multiblog mode is disabled by default, meaning that all BuddyPress content
* must be viewed on the root blog. It's also recommended not to use the
* BP_ENABLE_MULTIBLOG constant beyond 1.7, as BuddyPress can now be activated
* on individual sites.
*
* Why would you want to use this? Originally it was intended to allow
* BuddyPress to live in mu-plugins and be visible on mapped domains. This is
* a very small use-case with large architectural shortcomings, so do not go
* down this road unless you specifically need to.
*
* @since BuddyPress (1.5.0)
*
* @uses apply_filters() Filter 'bp_is_multiblog_mode' to alter.
*
* @return bool False when multiblog mode is disabled; true when enabled.
* Default: false.
*/
function bp_is_multiblog_mode()
{
// Setup some default values
$retval = false;
$is_multisite = is_multisite();
$network_active = bp_is_network_activated();
$is_multiblog = defined('BP_ENABLE_MULTIBLOG') && BP_ENABLE_MULTIBLOG;
// Multisite, Network Activated, and Specifically Multiblog
if ($is_multisite && $network_active && $is_multiblog) {
$retval = true;
// Multisite, but not network activated
} elseif ($is_multisite && !$network_active) {
$retval = true;
}
return apply_filters('bp_is_multiblog_mode', $retval);
}
示例4: bp_admin_separator
/**
* Add a separator to the WordPress admin menus.
*
* @since 1.7.0
*
* @uses bp_current_user_can() To check users capability on root blog.
*/
function bp_admin_separator()
{
// Bail if BuddyPress is not network activated and viewing network admin.
if (is_network_admin() && !bp_is_network_activated()) {
return;
}
// Bail if BuddyPress is network activated and viewing site admin.
if (!is_network_admin() && bp_is_network_activated()) {
return;
}
// Prevent duplicate separators when no core menu items exist.
if (!bp_current_user_can('bp_moderate')) {
return;
}
// Bail if there are no components with admin UI's. Hardcoded for now, until
// there's a real API for determining this later.
if (!bp_is_active('activity') && !bp_is_active('groups')) {
return;
}
global $menu;
$menu[] = array('', 'read', 'separator-buddypress', '', 'wp-menu-separator buddypress');
}
示例5: _bp_enforce_bp_moderate_cap_for_admins
/**
* Temporary implementation of 'bp_moderate' cap.
*
* In BuddyPress 1.6, the 'bp_moderate' cap was introduced. In order to
* enforce that bp_current_user_can( 'bp_moderate' ) always returns true for
* Administrators, we must manually add the 'bp_moderate' cap to the list of
* user caps for Admins.
*
* Note that this level of enforcement is only necessary in the case of
* non-Multisite. This is because WordPress automatically assigns every
* capability - and thus 'bp_moderate' - to Super Admins on a Multisite
* installation. See {@link WP_User::has_cap()}.
*
* This implementation of 'bp_moderate' is temporary, until BuddyPress properly
* matches caps to roles and stores them in the database. Plugin authors: Do
* not use this function.
*
* @access private
* @since BuddyPress (1.6.0)
*
* @see WP_User::has_cap()
*
* @param array $allcaps The caps that WP associates with the given role.
* @param array $caps The caps being tested for in WP_User::has_cap().
* @param array $args Miscellaneous arguments passed to the user_has_cap filter.
* @return array $allcaps The user's cap list, with 'bp_moderate' appended, if relevant.
*/
function _bp_enforce_bp_moderate_cap_for_admins($caps = array(), $cap = '', $user_id = 0, $args = array())
{
// Bail if not checking the 'bp_moderate' cap
if ('bp_moderate' !== $cap) {
return $caps;
}
// Bail if BuddyPress is not network activated
if (bp_is_network_activated()) {
return $caps;
}
// Never trust inactive users
if (bp_is_user_inactive($user_id)) {
return $caps;
}
// Only users that can 'manage_options' on this site can 'bp_moderate'
return array('manage_options');
}
示例6: emails_admin_menu_order
/**
* Add Emails menu item to custom menus array.
*
* Several BuddyPress components have top-level menu items in the Dashboard,
* which all appear together in the middle of the Dashboard menu. This function
* adds the Emails screen to the array of these menu items.
*
* @since 2.4.0
*
* @param array $custom_menus The list of top-level BP menu items.
* @return array $custom_menus List of top-level BP menu items, with Emails added.
*/
public function emails_admin_menu_order($custom_menus = array())
{
array_push($custom_menus, 'edit.php?post_type=' . bp_get_email_post_type());
if (is_network_admin() && bp_is_network_activated()) {
array_push($custom_menus, get_admin_url(bp_get_root_blog_id(), 'edit.php?post_type=' . bp_get_email_post_type()));
}
return $custom_menus;
}
示例7: bp_is_multiblog_mode
/**
* Are we running multiblog mode?
*
* Note that BP_ENABLE_MULTIBLOG is different from (but dependent on) WordPress
* Multisite. "Multiblog" is BuddyPress setup that allows BuddyPress components
* to be viewed on every blog on the network, each with their own settings.
*
* Thus, instead of having all 'boonebgorges' links go to
* http://example.com/members/boonebgorges
* on the root blog, each blog will have its own version of the same content, eg
* http://site2.example.com/members/boonebgorges (for subdomains)
* http://example.com/site2/members/boonebgorges (for subdirectories)
*
* Multiblog mode is disabled by default, meaning that all BuddyPress content
* must be viewed on the root blog. It's also recommended not to use the
* BP_ENABLE_MULTIBLOG constant beyond 1.7, as BuddyPress can now be activated
* on individual sites.
*
* Why would you want to use this? Originally it was intended to allow
* BuddyPress to live in mu-plugins and be visible on mapped domains. This is
* a very small use-case with large architectural shortcomings, so do not go
* down this road unless you specifically need to.
*
* @since BuddyPress (1.5.0)
*
* @uses apply_filters() Filter 'bp_is_multiblog_mode' to alter.
*
* @return bool False when multiblog mode is disabled; true when enabled.
* Default: false.
*/
function bp_is_multiblog_mode()
{
// Setup some default values
$retval = false;
$is_multisite = is_multisite();
$network_active = bp_is_network_activated();
$is_multiblog = defined('BP_ENABLE_MULTIBLOG') && BP_ENABLE_MULTIBLOG;
// Multisite, Network Activated, and Specifically Multiblog
if ($is_multisite && $network_active && $is_multiblog) {
$retval = true;
// Multisite, but not network activated
} elseif ($is_multisite && !$network_active) {
$retval = true;
}
/**
* Filters whether or not we're running in multiblog mode.
*
* @since BuddyPress (1.5.0)
*
* @param bool $retval Whether or not we're running multiblog mode.
*/
return apply_filters('bp_is_multiblog_mode', $retval);
}
示例8: wp_idea_stream_buddypress_is_managing_signup
/**
* Disable signups managment by WP Idea Stream if BuddyPress should manage them
*
* There can be a situation when WP Idea Stream is not activated on
* the network while BuddyPress is.
*
* @since 2.2.0
*
* @param bool $signup_allowed
* @return bool True if BuddyPress is not active on the current blog or the network, false otherwise
*/
function wp_idea_stream_buddypress_is_managing_signup($signup_allowed)
{
if (true === $signup_allowed && function_exists('buddypress')) {
$signup_allowed = !bp_is_root_blog() && !bp_is_network_activated();
}
return $signup_allowed;
}
示例9: setup_globals
/**
* Set admin-related globals.
*
* @access private
* @since BuddyPress (2.0.0)
*/
private function setup_globals()
{
$bp = buddypress();
// Paths and URLs
$this->admin_dir = trailingslashit($bp->plugin_dir . 'bp-members/admin');
// Admin path
$this->admin_url = trailingslashit($bp->plugin_url . 'bp-members/admin');
// Admin URL
$this->css_url = trailingslashit($this->admin_url . 'css');
// Admin CSS URL
$this->js_url = trailingslashit($this->admin_url . 'js');
// Admin CSS URL
// Capability depends on config
$this->capability = bp_core_do_network_admin() ? 'manage_network_users' : 'edit_users';
// The Edit Profile Screen id
$this->user_page = '';
// The Show Profile Screen id
$this->user_profile = is_network_admin() ? 'users' : 'profile';
// The current user id
$this->current_user_id = get_current_user_id();
// The user id being edited
$this->user_id = 0;
// Is a member editing their own profile
$this->is_self_profile = false;
// The screen ids to load specific css for
$this->screen_id = array();
// The stats metabox default position
$this->stats_metabox = new StdClass();
// BuddyPress edit user's profile args
$this->edit_profile_args = array('page' => 'bp-profile-edit');
$this->edit_profile_url = '';
$this->edit_url = '';
// Data specific to signups
$this->users_page = '';
$this->signups_page = '';
$this->users_url = bp_get_admin_url('users.php');
$this->users_screen = bp_core_do_network_admin() ? 'users-network' : 'users';
// Specific config: BuddyPress is not network activated
$this->subsite_activated = (bool) is_multisite() && !bp_is_network_activated();
// When BuddyPress is not network activated, only Super Admin can moderate signups
if (!empty($this->subsite_activated)) {
$this->capability = 'manage_network_users';
}
}
示例10: setup_globals
/**
* Set admin-related globals.
*
* @access private
* @since BuddyPress (2.0.0)
*/
private function setup_globals()
{
$bp = buddypress();
// Paths and URLs
$this->admin_dir = trailingslashit($bp->plugin_dir . 'bp-members/admin');
// Admin path
$this->admin_url = trailingslashit($bp->plugin_url . 'bp-members/admin');
// Admin URL
$this->css_url = trailingslashit($this->admin_url . 'css');
// Admin CSS URL
$this->js_url = trailingslashit($this->admin_url . 'js');
// Admin CSS URL
// Capability depends on config
$this->capability = bp_core_do_network_admin() ? 'manage_network_options' : 'manage_options';
// The Edit Profile Screen id
$this->user_page = '';
// The screen ids to load specific css for
$this->screen_id = array();
// The stats metabox default position
$this->stats_metabox = new StdClass();
// The WordPress edit user url
$this->edit_url = bp_get_admin_url('user-edit.php');
// BuddyPress edit user's profile url
$this->edit_profile_url = add_query_arg('page', 'bp-profile-edit', bp_get_admin_url('users.php'));
// Data specific to signups
$this->users_page = '';
$this->signups_page = '';
$this->users_url = bp_get_admin_url('users.php');
$this->users_screen = bp_core_do_network_admin() ? 'users-network' : 'users';
// Specific config: BuddyPress is not network activated
$this->subsite_activated = (bool) is_multisite() && !bp_is_network_activated();
// When BuddyPress is not network activated, only Super Admin can moderate signups
if (!empty($this->subsite_activated)) {
$this->capability = 'manage_network_options';
}
}
示例11: buddydrive_activation
/**
* Handles Plugin activation
*
* @uses bp_core_get_directory_page_ids() to get the BuddyPress component page ids
* @uses buddydrive_get_slug() to get BuddyDrive slug
* @uses wp_insert_post() to eventually create a new page for BuddyDrive
* @uses buddydrive_get_name() to get BuddyDrive plugin name
* @uses bp_core_update_directory_page_ids() to update the BuddyPres component pages ids
*/
function buddydrive_activation()
{
// For network, as plugin is not yet activated, bail method won't help..
if (is_network_admin() && function_exists('buddypress')) {
$check = !empty($_REQUEST) && 'activate' == $_REQUEST['action'] && $_REQUEST['plugin'] == buddydrive()->basename && bp_is_network_activated() && buddydrive::version_check();
} else {
$check = !buddydrive::bail();
}
if (empty($check)) {
return;
}
// let's check for BuddyDrive page in directory pages first !
$directory_pages = bp_core_get_directory_page_ids();
$buddydrive_slug = buddydrive_get_slug();
if (empty($directory_pages[$buddydrive_slug])) {
// let's create a page and add it to BuddyPress directory pages
$buddydrive_page_content = __('BuddyDrive uses this page to manage the downloads of your buddies files, please leave it as is. It will not show in your navigation bar.', 'buddydrive');
$buddydrive_page_id = wp_insert_post(array('comment_status' => 'closed', 'ping_status' => 'closed', 'post_title' => buddydrive_get_name(), 'post_content' => $buddydrive_page_content, 'post_name' => $buddydrive_slug, 'post_status' => 'publish', 'post_type' => 'page'));
$directory_pages[$buddydrive_slug] = $buddydrive_page_id;
bp_core_update_directory_page_ids($directory_pages);
}
do_action('buddydrive_activation');
}