From e085363aa5d1e32c01c4fbbe97f0000128b73f40 Mon Sep 17 00:00:00 2001 From: Jeremy Felt Date: Fri, 13 Feb 2015 06:30:26 +0000 Subject: [PATCH] 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 --- wp-includes/admin-bar.php | 2 ++ wp-includes/version.php | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/wp-includes/admin-bar.php b/wp-includes/admin-bar.php index 9e75de5d13..b4be9379af 100644 --- a/wp-includes/admin-bar.php +++ b/wp-includes/admin-bar.php @@ -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( diff --git a/wp-includes/version.php b/wp-includes/version.php index f73767070d..c91faf21d2 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -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.