WordPress.org

Make WordPress Core

Ticket #19122: 19122.3.diff

File 19122.3.diff, 1.6 KB (added by duck_, 2 years ago)
  • wp-includes/admin-bar.php

     
    210210function wp_admin_bar_site_menu( $wp_admin_bar ) { 
    211211        global $current_site; 
    212212 
    213         if ( ! is_user_logged_in() ) 
     213        // Show if the user is logged in, and they're a member of this site or are a super admin. 
     214        if ( ! is_user_logged_in() || ! is_user_member_of_blog( 0, get_current_blog_id() ) && ! is_super_admin() ) 
    214215                return; 
    215216 
    216217        $blogname = get_bloginfo('name'); 
     
    272273        if ( ! is_user_logged_in() || ! is_multisite() ) 
    273274                return; 
    274275 
    275         // Show only when there are more than two items in the menu. 
    276         if ( count( $wp_admin_bar->user->blogs ) <= 1 && ! is_super_admin() ) 
     276        // Show when the user has at least 1 site, or they're a super admin. 
     277        if ( count( $wp_admin_bar->user->blogs ) < 1 && ! is_super_admin() ) 
    277278                return; 
    278279 
    279280        $wp_admin_bar->add_menu( array( 
     
    331332        $blue_wp_logo_url = includes_url('images/wpmini-blue.png'); 
    332333 
    333334        foreach ( (array) $wp_admin_bar->user->blogs as $blog ) { 
    334                 // Skip the current blog (unless we're in the network/user admin). 
    335                 if ( $blog->userblog_id == get_current_blog_id() && ! is_network_admin() && ! is_user_admin() ) { 
    336                         continue; 
    337                 } 
    338  
    339335                // @todo Replace with some favicon lookup. 
    340336                //$blavatar = '<img src="' . esc_url( blavatar_url( blavatar_domain( $blog->siteurl ), 'img', 16, $blue_wp_logo_url ) ) . '" alt="Blavatar" width="16" height="16" />'; 
    341337                $blavatar = '<img src="' . esc_url($blue_wp_logo_url) . '" alt="' . esc_attr__( 'Blavatar' ) . '" width="16" height="16" class="blavatar"/>';