本文整理汇总了PHP中bp_core_do_network_admin函数的典型用法代码示例。如果您正苦于以下问题:PHP bp_core_do_network_admin函数的具体用法?PHP bp_core_do_network_admin怎么用?PHP bp_core_do_network_admin使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了bp_core_do_network_admin函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: bp_forums_add_admin_menu
function bp_forums_add_admin_menu()
{
if (!is_super_admin()) {
return false;
}
$page = bp_core_do_network_admin() ? 'settings.php' : 'options-general.php';
// Add the administration tab under the "Site Admin" tab for site administrators.
$hook = add_submenu_page($page, __('Forums', 'buddypress'), __('Forums', 'buddypress'), 'manage_options', 'bb-forums-setup', "bp_forums_bbpress_admin");
// Fudge the highlighted subnav item when on the BuddyPress Forums admin page.
add_action("admin_head-{$hook}", 'bp_core_modify_admin_menu_highlight');
}
示例2: test_has_htaccess
public function test_has_htaccess()
{
if (!function_exists('buddydrive_admin')) {
require_once buddydrive()->includes_dir . 'admin/buddydrive-admin.php';
}
// Load the admin
buddydrive_admin();
set_current_screen('plugins' . $this->suffix);
$notice_hook = bp_core_do_network_admin() ? 'network_admin_notices' : 'admin_notices';
do_action($notice_hook);
$this->assertTrue(file_exists(buddydrive()->upload_dir . '/.htaccess'));
}
示例3: etivite_bp_activity_block_admin_add_action_link
function etivite_bp_activity_block_admin_add_action_link($links, $file)
{
if ('buddypress-block-activity-stream-types/bp-activity-block-loader.php' != $file) {
return $links;
}
if (function_exists('bp_core_do_network_admin')) {
$settings_url = add_query_arg('page', 'bp-activity-block-settings', bp_core_do_network_admin() ? network_admin_url('admin.php') : admin_url('admin.php'));
} else {
$settings_url = add_query_arg('page', 'bp-activity-block-settings', is_multisite() ? network_admin_url('admin.php') : admin_url('admin.php'));
}
$settings_link = '<a href="' . $settings_url . '">' . __('Settings', 'bp-activity-block') . '</a>';
array_unshift($links, $settings_link);
return $links;
}
示例4: invite_anyone_admin_add_action_link
function invite_anyone_admin_add_action_link($links, $file)
{
if ('invite-anyone/invite-anyone.php' != $file) {
return $links;
}
if (function_exists('bp_core_do_network_admin')) {
$settings_url = add_query_arg('page', 'invite-anyone', bp_core_do_network_admin() ? network_admin_url('admin.php') : admin_url('admin.php'));
} else {
$settings_url = add_query_arg('page', 'invite-anyone', is_multisite() ? network_admin_url('admin.php') : admin_url('admin.php'));
}
$settings_link = '<a href="' . $settings_url . '">' . __('Settings', 'invite-anyone') . '</a>';
array_unshift($links, $settings_link);
return $links;
}
示例5: bp_checkins_needs_activity
function bp_checkins_needs_activity()
{
if (!bp_is_active('activity')) {
$buddy_settings_page = bp_core_do_network_admin() ? 'settings.php' : 'options-general.php';
?>
<div id="message" class="updated">
<p><?php
printf(__('If you want to use BP Checkins, you need to activate the Activity Stream BuddyPress component, to do so, please activate it in <a href="%s">BuddyPress settings</a>', 'bp-checkins'), bp_get_admin_url(add_query_arg(array('page' => 'bp-components'), $buddy_settings_page)));
?>
</p>
</div>
<?php
}
}
示例6: setup_admin
/**
* Setup our admin settings page and hooks
*/
public function setup_admin()
{
// Temporary workaround for the fact that WP's settings API doesn't work with MS
if (bp_core_do_network_admin()) {
if (!bp_is_root_blog()) {
return;
}
$parent = 'options-general.php';
} else {
$parent = 'bp-general-settings';
}
$page = add_submenu_page($parent, __('BuddyPress Reply By Email', 'bp-rbe'), __('BP Reply By Email', 'bp-rbe'), 'manage_options', 'bp-rbe', array($this, 'load'));
add_action("admin_head-{$page}", array($this, 'head'));
add_action("admin_footer-{$page}", array($this, 'footer'));
}
示例7: setup_globals
/**
* Admin globals
*
* @since BuddyPress (1.6)
* @access private
*/
private function setup_globals()
{
$bp = buddypress();
// Paths and URLs
$this->admin_dir = trailingslashit($bp->plugin_dir . 'bp-core/admin');
// Admin path
$this->admin_url = trailingslashit($bp->plugin_url . 'bp-core/admin');
// Admin url
$this->images_url = trailingslashit($this->admin_url . 'images');
// Admin images URL
$this->css_url = trailingslashit($this->admin_url . 'css');
// Admin css URL
$this->js_url = trailingslashit($this->admin_url . 'js');
// Admin css URL
// Main settings page
$this->settings_page = bp_core_do_network_admin() ? 'settings.php' : 'options-general.php';
}
示例8: bp_core_admin_settings_save
/**
* Save our settings
*
* @since BuddyPress (1.6)
*/
function bp_core_admin_settings_save()
{
global $wp_settings_fields;
if (isset($_GET['page']) && 'bp-settings' == $_GET['page'] && !empty($_POST['submit'])) {
check_admin_referer('buddypress-options');
// Because many settings are saved with checkboxes, and thus will have no values
// in the $_POST array when unchecked, we loop through the registered settings
if (isset($wp_settings_fields['buddypress'])) {
foreach ((array) $wp_settings_fields['buddypress'] as $section => $settings) {
foreach ($settings as $setting_name => $setting) {
$value = isset($_POST[$setting_name]) ? $_POST[$setting_name] : '';
bp_update_option($setting_name, $value);
}
}
}
// Some legacy options are not registered with the Settings API
$legacy_options = array('bp-disable-account-deletion', 'bp-disable-avatar-uploads', 'bp_disable_blogforum_comments', 'bp-disable-profile-sync', 'bp_restrict_group_creation', 'hide-loggedout-adminbar');
foreach ($legacy_options as $legacy_option) {
// Note: Each of these options is represented by its opposite in the UI
// Ie, the Profile Syncing option reads "Enable Sync", so when it's checked,
// the corresponding option should be unset
$value = isset($_POST[$legacy_option]) ? '' : 1;
bp_update_option($legacy_option, $value);
}
bp_core_redirect(add_query_arg('page', 'bp-settings', bp_core_do_network_admin() ? network_admin_url('admin.php') : admin_url('admin.php')));
}
}
示例9: checked
<label><input type="checkbox" name="group-show-forum"
id="group-show-forum"
value="1"<?php
checked(bp_get_new_group_enable_forum(), true, true);
?>
/> <?php
_e('Enable discussion forum', 'vibe');
?>
</label>
</div>
<?php
} elseif (is_super_admin()) {
?>
<p><?php
printf(__('<strong>Attention Site Admin:</strong> Group forums require the <a href="%s">correct setup and configuration</a> of a bbPress installation.', 'vibe'), bp_core_do_network_admin() ? network_admin_url('settings.php?page=bb-forums-setup') : admin_url('admin.php?page=bb-forums-setup'));
?>
</p>
<?php
}
?>
<?php
}
?>
<?php
do_action('bp_after_group_settings_creation_step');
?>
示例10: bp_core_admin_hook
/**
* Return the action name that BuddyPress nav setup callbacks should be hooked to.
*
* Functions used to set up BP Dashboard pages (wrapping such admin-panel
* functions as add_submenu_page()) should use bp_core_admin_hook() for the
* first parameter in add_action(). BuddyPress will then determine
* automatically whether to load the panels in the Network Admin. Ie:
*
* add_action( bp_core_admin_hook(), 'myplugin_dashboard_panel_setup' );
*
* @return string $hook The proper hook ('network_admin_menu' or 'admin_menu').
*/
function bp_core_admin_hook()
{
$hook = bp_core_do_network_admin() ? 'network_admin_menu' : 'admin_menu';
return apply_filters('bp_core_admin_hook', $hook);
}
示例11: bp_checkins_16_new_admin
/**
* BP 1.6beta1 new admin area
*/
function bp_checkins_16_new_admin()
{
if (defined('BP_VERSION') && version_compare(BP_VERSION, '1.6-beta2-6162', '>=')) {
$page = bp_core_do_network_admin() ? 'settings.php' : 'options-general.php';
return $page;
} else {
return 'bp-general-settings.php';
}
}
示例12: bp_core_activation_notice
/**
* Verify that some BP prerequisites are set up properly, and notify the admin if not
*
* On every Dashboard page, this function checks the following:
* - that pretty permalinks are enabled
* - that a BP-compatible theme is activated
* - that every BP component that needs a WP page for a directory has one
* - that no WP page has multiple BP components associated with it
* The administrator will be shown a notice for each check that fails.
*
* @package BuddyPress Core
*/
function bp_core_activation_notice()
{
global $wp_rewrite, $wpdb, $bp;
// Only the super admin gets warnings
if (!bp_current_user_can('bp_moderate')) {
return;
}
// On multisite installs, don't load on a non-root blog, unless do_network_admin is
// overridden
if (is_multisite() && bp_core_do_network_admin() && !bp_is_root_blog()) {
return;
}
// Don't show these messages during setup or upgrade
if (!empty($bp->maintenance_mode)) {
return;
}
/**
* Check to make sure that the blog setup routine has run. This can't happen during the
* wizard because of the order which the components are loaded. We check for multisite here
* on the off chance that someone has activated the blogs component and then disabled MS
*/
if (bp_is_active('blogs')) {
$count = $wpdb->get_var($wpdb->prepare("SELECT COUNT(*) FROM {$bp->blogs->table_name}"));
if (empty($count)) {
bp_blogs_record_existing_blogs();
}
}
/**
* Are pretty permalinks enabled?
*/
if (isset($_POST['permalink_structure'])) {
return false;
}
if (empty($wp_rewrite->permalink_structure)) {
bp_core_add_admin_notice(sprintf(__('<strong>BuddyPress is almost ready</strong>. You must <a href="%s">update your permalink structure</a> to something other than the default for it to work.', 'buddypress'), admin_url('options-permalink.php')));
}
/**
* Are you using a BP-compatible theme?
*/
// Get current theme info
$ct = wp_get_theme();
// Make sure tags is an array to suppress notices
if (!isset($ct->tags)) {
$ct->tags = array();
} else {
$ct->tags = (array) $ct->tags;
}
// The best way to remove this notice is to add a "buddypress" tag to
// your active theme's CSS header.
if (!defined('BP_SILENCE_THEME_NOTICE') && !in_array('buddypress', $ct->tags)) {
bp_core_add_admin_notice(sprintf(__("You'll need to <a href='%s'>activate a <strong>BuddyPress-compatible theme</strong></a> to take advantage of all of BuddyPress's features. We've bundled a default theme, but you can always <a href='%s'>install some other compatible themes</a> or <a href='%s'>update your existing WordPress theme</a>.", 'buddypress'), admin_url('themes.php'), network_admin_url('theme-install.php?type=tag&s=buddypress&tab=search'), network_admin_url('plugin-install.php?type=term&tab=search&s=%22bp-template-pack%22')));
}
/**
* Check for orphaned BP components (BP component is enabled, no WP page exists)
*/
$orphaned_components = array();
$wp_page_components = array();
// Only components with 'has_directory' require a WP page to function
foreach ($bp->loaded_components as $component_id => $is_active) {
if (!empty($bp->{$component_id}->has_directory)) {
$wp_page_components[] = array('id' => $component_id, 'name' => isset($bp->{$component_id}->name) ? $bp->{$component_id}->name : ucwords($bp->{$component_id}->id));
}
}
// Activate and Register are special cases. They are not components but they need WP pages.
// If user registration is disabled, we can skip this step.
if (bp_get_signup_allowed()) {
$wp_page_components[] = array('id' => 'activate', 'name' => __('Activate', 'buddypress'));
$wp_page_components[] = array('id' => 'register', 'name' => __('Register', 'buddypress'));
}
foreach ($wp_page_components as $component) {
if (!isset($bp->pages->{$component['id']})) {
$orphaned_components[] = $component['name'];
}
}
// Special case: If the Forums component is orphaned, but the bbPress 1.x installation is
// not correctly set up, don't show a nag. (In these cases, it's probably the case that the
// user is using bbPress 2.x; see https://buddypress.trac.wordpress.org/ticket/4292
if (isset($bp->forums->name) && in_array($bp->forums->name, $orphaned_components) && !bp_forums_is_installed_correctly()) {
$forum_key = array_search($bp->forums->name, $orphaned_components);
unset($orphaned_components[$forum_key]);
$orphaned_components = array_values($orphaned_components);
}
if (!empty($orphaned_components)) {
$admin_url = bp_get_admin_url(add_query_arg(array('page' => 'bp-page-settings'), 'admin.php'));
$notice = sprintf(__('The following active BuddyPress Components do not have associated WordPress Pages: %2$s. <a href="%1$s" class="button-secondary">Repair</a>', 'buddypress'), $admin_url, '<strong>' . implode('</strong>, <strong>', $orphaned_components) . '</strong>');
bp_core_add_admin_notice($notice);
}
/**
//.........这里部分代码省略.........
示例13: bp_get_admin_url
/**
* Return the correct URL based on BuddyPress and NXTClass configuration
*
* @package BuddyPress
* @since 1.5
*
* @param string $path
* @param string $scheme
*
* @uses bp_core_do_network_admin()
* @uses network_admin_url()
* @uses admin_url()
*/
function bp_get_admin_url($path = '', $scheme = 'admin')
{
// Links belong in network admin
if (bp_core_do_network_admin()) {
$url = network_admin_url($path, $scheme);
} else {
$url = admin_url($path, $scheme);
}
return $url;
}
示例14: admin_head
/**
* Hide submenu
*
* @package Rendez Vous
* @subpackage Admin
*
* @since Rendez Vous (1.2.0)
*/
public function admin_head()
{
$page = bp_core_do_network_admin() ? 'settings.php' : 'options-general.php';
remove_submenu_page($page, 'rendez-vous');
}
示例15: buddydrive_admin_settings
/**
* Displays the settings page
*
* @uses is_multisite() to check for multisite
* @uses add_query_arg() to add arguments to query in case of multisite
* @uses bp_get_admin_url to build the settings url in case of multisite
* @uses screen_icon() to show BuddyDrive icon
* @uses settings_fields()
* @uses do_settings_sections()
* @uses wp_nonce_field() for security reason in case of multisite
*/
function buddydrive_admin_settings()
{
$form_action = 'options.php';
if (bp_core_do_network_admin()) {
do_action('buddydrive_multisite_options');
$form_action = add_query_arg('page', 'buddydrive', bp_get_admin_url('settings.php'));
}
?>
<div class="wrap">
<?php
screen_icon('buddydrive');
?>
<h2><?php
_e('BuddyDrive Settings', 'buddydrive');
?>
</h2>
<form action="<?php
echo esc_url($form_action);
?>
" method="post">
<?php
settings_fields('buddydrive');
?>
<?php
do_settings_sections('buddydrive');
?>
<p class="submit">
<?php
if (bp_core_do_network_admin()) {
?>
<?php
wp_nonce_field('buddydrive_settings', '_wpnonce_buddydrive_setting');
?>
<?php
}
?>
<input type="submit" name="submit" class="button-primary" value="<?php
esc_attr_e('Save Changes', 'buddydrive');
?>
" />
</p>
</form>
</div>
<?php
}