Make WordPress Core

Opened 13 years ago

Closed 13 years ago

#18990 closed defect (bug) (invalid)

My Sites menu appears for 1 item

Reported by: kawauso's profile kawauso Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.3
Component: Administration Keywords: needs-patch
Focuses: Cc:

Description (last modified by kawauso)

In wp_admin_bar_my_sites_menu(), there's the following:

	// Show only when there are more than two items in the menu.
	if ( count( $wp_admin_bar->user->blogs ) <= 1 && ! is_super_admin() )
		return;

However, it also then skips the current blog item in certain circumstances:

		// Skip the current blog (unless we're in the network/user admin).
		if ( $blog->userblog_id == get_current_blog_id() && ! is_network_admin() && ! is_user_admin() ) {
			continue;
		}

Which throws the count out of the window.

Steps to reproduce:

  1. Visit a site where the current user has capabilities, has capabilities on one other site and isn't a super admin
  2. The current site will be hidden from the My Sites admin bar menu, but will still appear.

Attachments (1)

18990.patch (656 bytes) - added by kawauso 13 years ago.
Check early on for the current site removal conditions

Download all attachments as: .zip

Change History (5)

#1 @nacin
13 years ago

  • Milestone changed from Awaiting Review to 3.3

@kawauso
13 years ago

Check early on for the current site removal conditions

#2 @kawauso
13 years ago

  • Keywords needs-patch added; has-patch removed

Further to discussion with nacin, patch doesn't address when the current blog isn't included in the My Sites menu (such as when the user is browsing a site where they have no permissions).

Version 0, edited 13 years ago by kawauso (next)

#3 @kawauso
13 years ago

  • Description modified (diff)

#4 @duck_
13 years ago

  • Milestone 3.3 deleted
  • Resolution set to invalid
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.