Make WordPress Core

Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#31314 closed defect (bug) (fixed)

My Sites admin bar link broken when on blogs you have no role on

Reported by: simonwheatley Owned by: jeremyfelt
Priority: normal Milestone: 4.2
Component: Networks and Sites Version: 4.2
Severity: normal Keywords: has-patch
Cc: Focuses: administration, multisite

Description

Steps to reproduce:

  1. Create a WordPress multisite
  2. Create a new user
  3. Create two sites
  4. Give the user access to site 1, but not site 2
  5. Log in as the user
  6. Visit site 2
  7. Click on "My Sites" in the admin bar
  8. Error message about not having enough privilege

Attachments (2)

31314.diff (615 bytes ) - added by simonwheatley 12 years ago.
Wrap the add_menu call in switch_to_blog
31314.2.diff (1.5 KB ) - added by ocean90 12 years ago.
Use get_admin_url()

Download all attachments as: .zip

Change History (8)

@simonwheatley
12 years ago

Wrap the add_menu call in switch_to_blog

#1 @simonwheatley
12 years ago

  • Keywords has-patch dev-feedback added

Ping @jeremyfelt :)

#2 @jeremyfelt
12 years ago

  • Keywords dev-feedback removed
  • Milestone Awaiting Review4.2

That's a nice one. I'll take a closer look this evening, but the patch makes sense.

#3 @jeremyfelt
12 years ago

Confirmed. This definitely leads to a confusing interface for a user. I know I've been annoyed by this screen before. :)

We can use $wp_admin_bar->user->active_blog->blog_id instead, as it's populated properly when the admin bar is first initialized.

#4 @jeremyfelt
12 years ago

  • Owner set to jeremyfelt
  • Resolutionfixed
  • Status newclosed

In 31445:

Create the My Sites URL in the context of a user's primary site.

Switch to the user's primary (or active) site before creating the My Sites URL. This previously linked to the current site's dashboard, even if a user was not a member of that site.

Props simonwheatley for the initial patch.

Fixes #31314.

@ocean90
12 years ago

Use get_admin_url()

#5 @ocean90
12 years ago

@jeremyfelt Doesn't look 31314.2.diff a bit cleaner?

#6 @SergeyBiryukov
12 years ago

In 31448:

Use get_admin_url() to get the correct My Sites URL without calling switch_to_blog() directly.

props ocean90.
see #31314.

Note: See TracTickets for help on using tickets.