Skip to:
Content

BuddyPress.org

Ticket #3560: 3560.001.diff

File 3560.001.diff, 1.7 KB (added by cnorris23, 13 years ago)
  • bp-core/bp-core-buddybar.php

     
    526526/**
    527527 * Handle the Admin Bar/BuddyBar business
    528528 *
    529  * @global num $wp_version
    530  * @todo Clean up global constants
     529 * @since 1.2.0
     530 *
     531 * @global string $wp_version
     532 * @uses bp_get_option()
     533 * @uses is_user_logged_in()
     534 * @uses bp_use_wp_admin_bar()
     535 * @uses show_admin_bar()
     536 * @uses add_action() To hook 'bp_adminbar_logo' to 'bp_adminbar_logo'
     537 * @uses add_action() To hook 'bp_adminbar_login_menu' to 'bp_adminbar_menus'
     538 * @uses add_action() To hook 'bp_adminbar_account_menu' to 'bp_adminbar_menus'
     539 * @uses add_action() To hook 'bp_adminbar_thisblog_menu' to 'bp_adminbar_menus'
     540 * @uses add_action() To hook 'bp_adminbar_random_menu' to 'bp_adminbar_menus'
     541 * @uses add_action() To hook 'bp_core_admin_bar' to 'wp_footer'
     542 * @uses add_action() To hook 'bp_core_admin_bar' to 'admin_footer'
    531543 */
    532544function bp_core_load_admin_bar() {
    533545        global $wp_version;
    534546
     547        // Don't show if admin bar is disabled for non-logged in users
     548        if ( (int) bp_get_option( 'hide-loggedout-adminbar' ) && !is_user_logged_in() )
     549                return;
     550
    535551        // Show the WordPress admin bar
    536552        if ( bp_use_wp_admin_bar() && $wp_version >= 3.1 ) {
    537553                show_admin_bar( true );
     
    542558                // Keep the WP admin bar from loading
    543559                show_admin_bar( false );
    544560
    545                 if ( (int)bp_get_option( 'hide-loggedout-adminbar' ) && !is_user_logged_in() )
    546                         return;
    547 
    548561                // Actions used to build the BP admin bar
    549562                add_action( 'bp_adminbar_logo',  'bp_adminbar_logo' );
    550563                add_action( 'bp_adminbar_menus', 'bp_adminbar_login_menu',         2   );