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.

Built from https://develop.svn.wordpress.org/trunk@31445


git-svn-id: http://core.svn.wordpress.org/trunk@31426 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Jeremy Felt 2015-02-13 06:30:26 +00:00
parent 5a0b01edf1
commit e085363aa5
2 changed files with 3 additions and 1 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(

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.2-alpha-31443';
$wp_version = '4.2-alpha-31445';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.