Make WordPress Core

Changeset 19184


Ignore:
Timestamp:
11/06/2011 12:21:12 PM (13 years ago)
Author:
duck_
Message:

Hide Site Name menu if the user isn't a member and isn't a super admin. Always show My Sites if the user has a site, and don't remove the current site from the list. Fixes #19122.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/admin-bar.php

    r19166 r19184  
    211211    global $current_site;
    212212
     213    // Don't show for logged out users.
    213214    if ( ! is_user_logged_in() )
     215        return;
     216
     217    // Show only when the user is a member of this site, or they're a super admin.
     218    if ( ! is_user_member_of_blog( get_current_user_id(), get_current_blog_id() ) && ! is_super_admin() )
    214219        return;
    215220
     
    273278        return;
    274279
    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() )
     280    // Show only when the user has at least one site, or they're a super admin.
     281    if ( count( $wp_admin_bar->user->blogs ) < 1 && ! is_super_admin() )
    277282        return;
    278283
     
    332337
    333338    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 
    339339        // @todo Replace with some favicon lookup.
    340340        //$blavatar = '<img src="' . esc_url( blavatar_url( blavatar_domain( $blog->siteurl ), 'img', 16, $blue_wp_logo_url ) ) . '" alt="Blavatar" width="16" height="16" />';
Note: See TracChangeset for help on using the changeset viewer.