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.


git-svn-id: https://develop.svn.wordpress.org/trunk@31445 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Jeremy Felt 2015-02-13 06:29:57 +00:00
parent 5ec46121cd
commit 2002097f6f
1 changed files with 2 additions and 0 deletions

View File

@ -333,11 +333,13 @@ function wp_admin_bar_my_sites_menu( $wp_admin_bar ) {
if ( count( $wp_admin_bar->user->blogs ) < 1 && ! is_super_admin() )
return;
switch_to_blog( $wp_admin_bar->user->active_blog->blog_id );
$wp_admin_bar->add_menu( array(
'id' => 'my-sites',
'title' => __( 'My Sites' ),
'href' => admin_url( 'my-sites.php' ),
) );
restore_current_blog();
if ( is_super_admin() ) {
$wp_admin_bar->add_group( array(