Skip to content

Commit 3d008fb

Browse files
committed
Support for upcoming changes to the admin bar in WordPress 3.3.
git-svn-id: http://plugins.svn.wordpress.org/user-switching/trunk@449649 b8457f37-d9ea-0310-8a92-e5e31aec5664
1 parent 8496d19 commit 3d008fb

2 files changed

Lines changed: 15 additions & 8 deletions

File tree

readme.txt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Contributors: johnbillion
33
Donate link: http://lud.icro.us/donations/
44
Tags: user, users, profiles, switching, wpmu, multisite, buddypress
55
Requires at least: 2.7
6-
Tested up to: 3.2.1
6+
Tested up to: 3.3
77
Stable tag: trunk
88

99
Instant switching between user accounts in WordPress, WordPress Multisite, BuddyPress and WordPress MU.
@@ -59,6 +59,9 @@ Yes, except you'll need to install 'user-switching.php' into the root of your mu
5959

6060
== Changelog ==
6161

62+
= 0.4.1 =
63+
* Support for upcoming changes to the admin bar in WordPress 3.3.
64+
6265
= 0.4 =
6366
* Add some extended support for BuddyPress.
6467
* Add some extended support for Multisite.
@@ -90,5 +93,8 @@ Yes, except you'll need to install 'user-switching.php' into the root of your mu
9093

9194
== Upgrade Notice ==
9295

96+
= 0.4.1 =
97+
* Support for upcoming changes to the admin bar in WordPress 3.3.
98+
9399
= 0.4 =
94100
User switching links on Network Admin screens and BuddyPress user screens.

user-switching.php

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
/*
33
Plugin Name: User Switching
44
Description: Instant switching between user accounts in WordPress
5-
Version: 0.4
5+
Version: 0.4.1
66
Plugin URI: http://lud.icro.us/wordpress-plugin-user-switching/
77
Author: John Blackbourn
88
Author URI: http://johnblackbourn.com/
@@ -150,13 +150,14 @@ function admin_bar_menu() {
150150

151151
if ( $old_user = $this->get_old_user() ) {
152152

153-
$parent = get_option( 'show_avatars' ) ? 'my-account-with-avatar' : 'my-account';
153+
foreach ( array( 'my-account-with-avatar', 'my-account' ) as $parent ) {
154+
$wp_admin_bar->add_menu( array(
155+
'parent' => $parent,
156+
'title' => sprintf( __( 'Switch back to %1$s (%2$s)', 'user_switching' ), $old_user->display_name, $old_user->user_login ),
157+
'href' => $this->switch_back_url()
158+
) );
159+
}
154160

155-
$wp_admin_bar->add_menu( array(
156-
'parent' => $parent,
157-
'title' => sprintf( __( 'Switch back to %1$s (%2$s)', 'user_switching' ), $old_user->display_name, $old_user->user_login ),
158-
'href' => $this->switch_back_url()
159-
) );
160161
}
161162

162163
}

0 commit comments

Comments
 (0)