当前位置: 首页>>代码示例>>PHP>>正文


PHP bp_use_wp_admin_bar函数代码示例

本文整理汇总了PHP中bp_use_wp_admin_bar函数的典型用法代码示例。如果您正苦于以下问题:PHP bp_use_wp_admin_bar函数的具体用法?PHP bp_use_wp_admin_bar怎么用?PHP bp_use_wp_admin_bar使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了bp_use_wp_admin_bar函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: admin_nav

 function admin_nav()
 {
     global $wp_admin_bar;
     global $rtmedia;
     if (!isset($rtmedia->options['buddypress_enableOnProfile']) || isset($rtmedia->options['buddypress_enableOnProfile']) && $rtmedia->options['buddypress_enableOnProfile'] == '0') {
         return;
     }
     if (function_exists("bp_use_wp_admin_bar") && !bp_use_wp_admin_bar()) {
         return;
     }
     // Bail if this is an ajax request
     if (defined('DOING_AJAX')) {
         return;
     }
     // Only add menu for logged in user
     if (is_user_logged_in()) {
         // Add secondary parent item for all BuddyPress components
         $wp_admin_bar->add_menu(array('parent' => 'my-account', 'id' => 'my-account-' . RTMEDIA_MEDIA_SLUG, 'title' => RTMEDIA_MEDIA_LABEL, 'href' => trailingslashit(get_rtmedia_user_link(get_current_user_id())) . RTMEDIA_MEDIA_SLUG . '/'));
         if (is_rtmedia_album_enable()) {
             $wp_admin_bar->add_menu(array('parent' => 'my-account-' . RTMEDIA_MEDIA_SLUG, 'id' => 'my-account-media-' . RTMEDIA_ALBUM_SLUG, 'title' => RTMEDIA_ALBUM_PLURAL_LABEL, 'href' => trailingslashit(get_rtmedia_user_link(get_current_user_id())) . RTMEDIA_MEDIA_SLUG . '/album/'));
         }
         global $rtmedia;
         foreach ($rtmedia->allowed_types as $type) {
             if (isset($rtmedia->options['allowedTypes_' . $type['name'] . '_enabled'])) {
                 if (!$rtmedia->options['allowedTypes_' . $type['name'] . '_enabled']) {
                     continue;
                 }
                 $name = strtoupper($type['name']);
                 $wp_admin_bar->add_menu(array('parent' => 'my-account-' . constant('RTMEDIA_MEDIA_SLUG'), 'id' => 'my-account-media-' . constant('RTMEDIA_' . $name . '_SLUG'), 'title' => $type['plural_label'], 'href' => trailingslashit(get_rtmedia_user_link(get_current_user_id())) . RTMEDIA_MEDIA_SLUG . '/' . constant('RTMEDIA_' . $name . '_SLUG') . '/'));
             }
         }
     }
 }
开发者ID:saisai,项目名称:rtMedia,代码行数:33,代码来源:RTMediaNav.php

示例2: bp_follow_user_setup_nav

/**
 * Setup profile / BuddyBar navigation.
 *
 * This function was moved from {@link BP_Follow_Component} in v1.3.0 due
 * to the users module being toggleable.
 *
 * @since 1.3.0
 */
function bp_follow_user_setup_nav($main_nav = array(), $sub_nav = array())
{
    global $bp;
    // If we're in the admin area and we're using the WP toolbar, we don't need
    // to run the rest of this method
    if (defined('WP_NETWORK_ADMIN') && bp_use_wp_admin_bar()) {
        return;
    }
    // Need to change the user ID, so if we're not on a member page, $counts variable is still calculated
    $user_id = bp_is_user() ? bp_displayed_user_id() : bp_loggedin_user_id();
    $counts = bp_follow_total_follow_counts(array('user_id' => $user_id));
    // BuddyBar compatibility
    $domain = bp_displayed_user_domain() ? bp_displayed_user_domain() : bp_loggedin_user_domain();
    /** FOLLOWERS NAV ************************************************/
    bp_core_new_nav_item(array('name' => sprintf(__('Following <span>%d</span>', 'bp-follow'), $counts['following']), 'slug' => $bp->follow->following->slug, 'position' => $bp->follow->params['adminbar_myaccount_order'], 'screen_function' => 'bp_follow_screen_following', 'default_subnav_slug' => 'following', 'item_css_id' => 'members-following'));
    /** FOLLOWING NAV ************************************************/
    bp_core_new_nav_item(array('name' => sprintf(__('Followers <span>%d</span>', 'bp-follow'), $counts['followers']), 'slug' => $bp->follow->followers->slug, 'position' => apply_filters('bp_follow_followers_nav_position', 62), 'screen_function' => 'bp_follow_screen_followers', 'default_subnav_slug' => 'followers', 'item_css_id' => 'members-followers'));
    /** ACTIVITY SUBNAV **********************************************/
    // Add activity sub nav item
    if (bp_is_active('activity') && apply_filters('bp_follow_show_activity_subnav', true)) {
        bp_core_new_subnav_item(array('name' => _x('Following', 'Activity subnav tab', 'bp-follow'), 'slug' => constant('BP_FOLLOWING_SLUG'), 'parent_url' => trailingslashit($domain . bp_get_activity_slug()), 'parent_slug' => bp_get_activity_slug(), 'screen_function' => 'bp_follow_screen_activity_following', 'position' => 21, 'item_css_id' => 'activity-following'));
    }
    // BuddyBar compatibility
    add_action('bp_adminbar_menus', 'bp_follow_group_buddybar_items');
}
开发者ID:vikramshaw,项目名称:buddypress-followers,代码行数:33,代码来源:hooks.php

示例3: alt_bp_change_settings_default

 function alt_bp_change_settings_default()
 {
     global $bp;
     $args = array('parent_slug' => 'settings', 'screen_function' => 'bp_core_screen_notification_settings', 'subnav_slug' => 'notifications');
     bp_core_new_nav_default($args);
     if (bp_use_wp_admin_bar()) {
         add_action('wp_before_admin_bar_render', create_function('', 'global $wp_admin_bar; $wp_admin_bar->remove_menu( "my-account-settings-general" );'));
     }
 }
开发者ID:pajtai,项目名称:saml-20-single-sign-on-alt,代码行数:9,代码来源:samlauth.php

示例4: __construct

 function __construct($tp_active = false)
 {
     global $current_blog, $gsm_simple_menu;
     $this->home = !is_multisite() || defined('BP_ENABLE_MULTIBLOG') || $current_blog->blog_id == BP_ROOT_BLOG;
     $this->adminbar = !(bp_use_wp_admin_bar() || defined('BP_DISABLE_ADMIN_BAR') || get_site_option('hide-loggedout-adminbar') && !is_user_logged_in());
     $this->stylesheet = get_option('stylesheet');
     $this->settings = get_option($this->settings_key);
     if (!($this->style = genesis_get_option('style_selection'))) {
         $this->style = 'style.css';
     }
     if ($this->simple_menu = !empty($gsm_simple_menu)) {
         $this->custom_subnav =& $gsm_simple_menu;
     }
     do_action('gconnect_before_init');
     if (is_admin()) {
         require_once GENESISCONNECT_DIR . 'lib/class.options.php';
         $this->admin = new GConnect_Admin($this, $tp_active);
     } else {
         require_once GENESISCONNECT_DIR . 'lib/class.front.php';
         $this->front = new GConnect_Front($this, $tp_active);
         if (!$tp_active && !is_user_logged_in() && $this->home) {
             $custom_register = $this->get_option('custom_register');
             if ($custom_register && 'none' != $custom_register) {
                 require_once GENESISCONNECT_DIR . 'lib/class.visitor.php';
                 $this->front->set_visitor(new GConnect_visitor($this, $custom_register));
             } elseif (is_multisite()) {
                 add_action('wp', array(&$this, 'bp_core_wpsignup_redirect'));
             } else {
                 add_action('init', array(&$this, 'bp_core_wpsignup_redirect'));
             }
         }
     }
     if ('widget' == $this->get_option('before_content')) {
         genesis_register_sidebar(array('name' => 'Before BuddyPress', 'description' => __('This is above the BuddyPress content', 'genesis-connect'), 'id' => 'gconnect-before'));
     }
     if (is_dir(GENESISCONNECT_DIR . 'child-theme/' . $this->stylesheet)) {
         $addon_directory = GENESISCONNECT_DIR . 'child-theme/' . $this->stylesheet;
         $addon_functions = $addon_directory . '/my-functions.php';
         if (is_file($addon_functions)) {
             require_once $addon_functions;
         }
         if (!is_admin()) {
             $this->front->set_addon($addon_directory, GENESISCONNECT_URL . 'child-theme/' . $this->stylesheet);
         }
     } elseif (!is_admin()) {
         $this->front->set_addon(get_stylesheet_directory(), get_stylesheet_directory_uri());
     }
     do_action('gconnect_after_init');
 }
开发者ID:hscale,项目名称:webento,代码行数:49,代码来源:class.theme.php

示例5: bp_core_load_admin_bar_css

/**
 * Handle the Toolbar CSS.
 *
 * @since BuddyPress (1.5.0)
 */
function bp_core_load_admin_bar_css()
{
    global $wp_styles;
    if (!bp_use_wp_admin_bar() || !is_admin_bar_showing()) {
        return;
    }
    $min = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min';
    // Toolbar styles
    $stylesheet = buddypress()->plugin_url . "bp-core/css/admin-bar{$min}.css";
    wp_enqueue_style('bp-admin-bar', apply_filters('bp_core_admin_bar_css', $stylesheet), array('admin-bar'), bp_get_version());
    $wp_styles->add_data('bp-admin-bar', 'rtl', true);
    if ($min) {
        $wp_styles->add_data('bp-admin-bar', 'suffix', $min);
    }
}
开发者ID:danielcoats,项目名称:schoolpress,代码行数:20,代码来源:bp-core-adminbar.php

示例6: bp_core_load_admin_bar_css

/**
 * Handle the Toolbar CSS
 *
 * @since BuddyPress 1.5
 */
function bp_core_load_admin_bar_css()
{
    if (!bp_use_wp_admin_bar() || !is_admin_bar_showing()) {
        return;
    }
    // Toolbar styles
    if (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) {
        $stylesheet = BP_PLUGIN_URL . 'bp-core/css/admin-bar.dev.css';
    } else {
        $stylesheet = BP_PLUGIN_URL . 'bp-core/css/admin-bar.css';
    }
    wp_enqueue_style('bp-admin-bar', apply_filters('bp_core_admin_bar_css', $stylesheet), array('admin-bar'), bp_get_version());
    if (!is_rtl()) {
        return;
    }
    if (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) {
        $stylesheet = BP_PLUGIN_URL . 'bp-core/css/admin-bar-rtl.dev.css';
    } else {
        $stylesheet = BP_PLUGIN_URL . 'bp-core/css/admin-bar-rtl.css';
    }
    wp_enqueue_style('bp-admin-bar-rtl', apply_filters('bp_core_admin_bar_rtl_css', $stylesheet), array('bp-admin-bar'), bp_get_version());
}
开发者ID:adisonc,项目名称:MaineLearning,代码行数:27,代码来源:bp-core-adminbar.php

示例7: bp_core_load_admin_bar_css

/**
 * Handle the Admin Bar CSS
 *
 * @since BuddyPress 1.5
 */
function bp_core_load_admin_bar_css()
{
    $version = '2011116';
    if (!bp_use_wp_admin_bar() || defined('DOING_AJAX')) {
        return;
    }
    // Admin bar styles
    if (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) {
        $stylesheet = BP_PLUGIN_URL . '/bp-core/css/admin-bar.dev.css';
    } else {
        $stylesheet = BP_PLUGIN_URL . '/bp-core/css/admin-bar.css';
    }
    wp_enqueue_style('bp-admin-bar', apply_filters('bp_core_admin_bar_css', $stylesheet), array('admin-bar'), $version);
    if (!is_rtl()) {
        return;
    }
    if (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) {
        $stylesheet = BP_PLUGIN_URL . '/bp-core/css/admin-bar-rtl.dev.css';
    } else {
        $stylesheet = BP_PLUGIN_URL . '/bp-core/css/admin-bar-rtl.css';
    }
    wp_enqueue_style('bp-admin-bar-rtl', apply_filters('bp_core_admin_bar_rtl_css', $stylesheet), array('bp-admin-bar'), $version);
}
开发者ID:newington,项目名称:buddypress,代码行数:28,代码来源:bp-core-adminbar.php

示例8: setup_admin_bar

 /**
  * Setup the Toolbar
  *
  * @global obj $wp_admin_bar
  * @param array $wp_admin_menus
  */
 function setup_admin_bar($wp_admin_nav = '')
 {
     // Bail if this is an ajax request
     if (defined('DOING_AJAX')) {
         return;
     }
     // Do not proceed if BP_USE_WP_ADMIN_BAR constant is not set or is false
     if (!bp_use_wp_admin_bar()) {
         return;
     }
     // Do we have Toolbar menus to add?
     if (!empty($wp_admin_nav)) {
         // Set this objects menus
         $this->admin_menu = $wp_admin_nav;
         // Define the WordPress global
         global $wp_admin_bar;
         // Add each admin menu
         foreach ($this->admin_menu as $admin_menu) {
             $wp_admin_bar->add_menu($admin_menu);
         }
     }
     // Call action
     do_action('bp_' . $this->id . '_setup_admin_bar');
 }
开发者ID:adisonc,项目名称:MaineLearning,代码行数:30,代码来源:bp-core-component.php

示例9: bp_core_load_buddybar_css

/**
 * Enqueue the BuddyBar CSS.
 *
 * @deprecated BuddyPress (2.1.0)
 */
function bp_core_load_buddybar_css()
{
    if (bp_use_wp_admin_bar() || (int) bp_get_option('hide-loggedout-adminbar') && !is_user_logged_in() || defined('BP_DISABLE_ADMIN_BAR') && BP_DISABLE_ADMIN_BAR) {
        return;
    }
    $min = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min';
    if (file_exists(get_stylesheet_directory() . '/_inc/css/adminbar.css')) {
        // Backwards compatibility
        $stylesheet = get_stylesheet_directory_uri() . '/_inc/css/adminbar.css';
    } else {
        $stylesheet = buddypress()->plugin_url . "bp-core/css/buddybar{$min}.css";
    }
    wp_enqueue_style('bp-admin-bar', apply_filters('bp_core_buddybar_rtl_css', $stylesheet), array(), bp_get_version());
    wp_style_add_data('bp-admin-bar', 'rtl', true);
    if ($min) {
        wp_style_add_data('bp-admin-bar', 'suffix', $min);
    }
}
开发者ID:eresyyl,项目名称:mk,代码行数:23,代码来源:2.1.php

示例10: bp_setup_admin_bar

/**
 * Fire the 'bp_setup_admin_bar' action, where plugins should add items to the WP admin bar.
 */
function bp_setup_admin_bar()
{
    if (bp_use_wp_admin_bar()) {
        do_action('bp_setup_admin_bar');
    }
}
开发者ID:eresyyl,项目名称:mk,代码行数:9,代码来源:bp-core-dependency.php

示例11: setup_admin_bar

 /**
  * Set up the component entries in the WordPress Admin Bar.
  *
  * @since 1.5.0
  *
  * @see WP_Admin_Bar::add_menu() for a description of the syntax
  *      required by each item in the $wp_admin_nav parameter array.
  * @global object $wp_admin_bar
  *
  * @param array $wp_admin_nav An array of nav item arguments. Each item in this parameter
  *                            array is passed to {@link WP_Admin_Bar::add_menu()}.
  *                            See that method for a description of the required syntax for
  *                            each item.
  */
 public function setup_admin_bar($wp_admin_nav = array())
 {
     // Bail if this is an ajax request.
     if (defined('DOING_AJAX')) {
         return;
     }
     // Do not proceed if BP_USE_WP_ADMIN_BAR constant is not set or is false.
     if (!bp_use_wp_admin_bar()) {
         return;
     }
     /**
      * Filters the admin navigation passed into setup_admin_bar.
      *
      * This is a dynamic hook that is based on the component string ID.
      *
      * @since 1.9.0
      *
      * @param array $wp_admin_nav Array of navigation items to add.
      */
     $wp_admin_nav = apply_filters('bp_' . $this->id . '_admin_nav', $wp_admin_nav);
     // Do we have Toolbar menus to add?
     if (!empty($wp_admin_nav)) {
         // Fill in position if one wasn't passed for backpat.
         $pos = 0;
         $not_set_pos = 1;
         foreach ($wp_admin_nav as $key => $nav) {
             if (!isset($nav['position'])) {
                 $wp_admin_nav[$key]['position'] = $pos + $not_set_pos;
                 if (9 !== $not_set_pos) {
                     ++$not_set_pos;
                 }
             } else {
                 $pos = $nav['position'];
                 // Reset not set pos to 1
                 if ($pos % 10 === 0) {
                     $not_set_pos = 1;
                 }
             }
         }
         // Sort admin nav by position.
         $wp_admin_nav = bp_sort_by_key($wp_admin_nav, 'position', 'num');
         // Set this objects menus.
         $this->admin_menu = $wp_admin_nav;
         // Define the WordPress global.
         global $wp_admin_bar;
         // Add each admin menu.
         foreach ($this->admin_menu as $admin_menu) {
             $wp_admin_bar->add_menu($admin_menu);
         }
     }
     /**
      * Fires at the end of the setup_admin_bar method inside BP_Component.
      *
      * This is a dynamic hook that is based on the component string ID.
      *
      * @since 1.5.0
      */
     do_action('bp_' . $this->id . '_setup_admin_bar');
 }
开发者ID:igniterealtime,项目名称:community-plugins,代码行数:73,代码来源:class-bp-component.php

示例12: bp_setup_admin_bar

/**
 * Fire the 'bp_setup_admin_bar' action, where plugins should add items to the WP admin bar.
 */
function bp_setup_admin_bar()
{
    if (bp_use_wp_admin_bar()) {
        /**
         * Fires inside the 'bp_setup_admin_bar' function, where plugins should add items to the WP admin bar.
         *
         * This hook will only fire if bp_use_wp_admin_bar() returns true.
         *
         * @since BuddyPress (1.5.0)
         */
        do_action('bp_setup_admin_bar');
    }
}
开发者ID:kosir,项目名称:thatcamp-org,代码行数:16,代码来源:bp-core-dependency.php

示例13: bp_core_enqueue_admin_bar_css

/**
 * Enqueue supplemental WordPress Toolbar styling
 *
 * @since BuddyPress (2.1.0)
 *
 * @see bp_core_register_common_styles()
 * @see bp_core_load_admin_bar_css()
 */
function bp_core_enqueue_admin_bar_css()
{
    // Bail if not using WordPress's admin bar or it's not showing on this
    // page request.
    if (!bp_use_wp_admin_bar() || !is_admin_bar_showing()) {
        return;
    }
    // Enqueue the additional adminbar css
    wp_enqueue_style('bp-admin-bar');
}
开发者ID:sdh100shaun,项目名称:pantheon,代码行数:18,代码来源:bp-core-adminbar.php

示例14: setup_admin_bar

 /**
  * Set up the component entries in the WordPress Admin Bar.
  *
  * @see WP_Admin_Bar::add_menu() for a description of the syntax
  *      required by each item in the $wp_admin_nav parameter array.
  * @global obj $wp_admin_bar
  *
  * @param array $wp_admin_nav An array of nav item arguments. Each item
  *        in this parameter array is passed to {@link WP_Admin_Bar::add_menu()}.
  *        See that method for a description of the required syntax for
  *        each item.
  */
 public function setup_admin_bar($wp_admin_nav = array())
 {
     // Bail if this is an ajax request
     if (defined('DOING_AJAX')) {
         return;
     }
     // Do not proceed if BP_USE_WP_ADMIN_BAR constant is not set or is false
     if (!bp_use_wp_admin_bar()) {
         return;
     }
     /**
      * Filters the admin navigation passed into setup_admin_bar.
      *
      * This is a dynamic hook that is based on the component string ID.
      *
      * @since BuddyPress (1.9.0)
      *
      * @param array $wp_admin_nav Array of navigation items to add.
      */
     $wp_admin_nav = apply_filters('bp_' . $this->id . '_admin_nav', $wp_admin_nav);
     // Do we have Toolbar menus to add?
     if (!empty($wp_admin_nav)) {
         // Set this objects menus
         $this->admin_menu = $wp_admin_nav;
         // Define the WordPress global
         global $wp_admin_bar;
         // Add each admin menu
         foreach ($this->admin_menu as $admin_menu) {
             $wp_admin_bar->add_menu($admin_menu);
         }
     }
     /**
      * Fires at the end of the setup_admin_bar method inside BP_Component.
      *
      * This is a dynamic hook that is based on the component string ID.
      *
      * @since BuddyPress (1.5.0)
      */
     do_action('bp_' . $this->id . '_setup_admin_bar');
 }
开发者ID:kosir,项目名称:thatcamp-org,代码行数:52,代码来源:bp-core-component.php

示例15: bp_notifications_manager_subnav

/**
 * Hide Notification subnav item and menu element and all acces
 * to notifications settings page if bp_notifications_manager_disabled is yes
 */
function bp_notifications_manager_subnav()
{
    if (get_option('bp_notifications_manager_disabled') == 'yes') {
        global $bp;
        // if current user is not admin
        //if( !is_site_admin() ){ // this work only for bp 1.6 ( so i use  !current_user_can('manage_options') to check if is admin user)
        if (!current_user_can('manage_options')) {
            bp_core_remove_subnav_item($bp->settings->slug, 'notifications');
            //bp_core_remove_nav_item( $bp->settings->slug, 'notifications' );
            // //remove notifcation subnav item and notification link for adminbar
            //bp_core_remove_subnav_item($bp->settings->slug, 'notifications');
            //remove_action( 'bp_adminbar_menus', 'bp_adminbar_notifications_menu', 8 );
            // remove notification setting link from wp adminbar if is bp use it
            if (bp_use_wp_admin_bar()) {
                $bp->temp_slug = $slug;
                add_action('wp_before_admin_bar_render', create_function('', 'global $bp, $wp_admin_bar; $wp_admin_bar->remove_menu( "my-account-settings-notifications" );'));
            }
        }
    }
}
开发者ID:garrett-eclipse,项目名称:buddypress-notifications-manager,代码行数:24,代码来源:loader.php


注:本文中的bp_use_wp_admin_bar函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。