User Switching - Version 0.8.6

Version Description

  • Correctly encode the redirect_to parameter in the login screen message.

=

Download this release

Release Info

Developer johnbillion
Plugin Icon 128x128 User Switching
Version 0.8.6
Comparing to
See all releases

Code changes from version 0.8.5 to 0.8.6

Files changed (2) hide show
  1. readme.txt +211 -208
  2. user-switching.php +3 -3
readme.txt CHANGED
@@ -1,208 +1,211 @@
1
- === User Switching ===
2
-
3
- Contributors: johnbillion
4
- Tags: user, users, profiles, switching, wpmu, multisite, buddypress, bbpress, become, user control, user management, user access, developer
5
- Requires at least: 3.1
6
- Tested up to: 3.8
7
- Stable tag: 0.8.5
8
- License: GPL v2 or later
9
-
10
- Instant switching between user accounts in WordPress.
11
-
12
- == Description ==
13
-
14
- This plugin allows you to quickly swap between user accounts in WordPress at the click of a button. You'll be instantly logged out and logged in as your desired user. This is handy for test environments where you regularly log out and in between different accounts, or for adminstrators who need to switch between multiple accounts.
15
-
16
- = Features =
17
-
18
- * Switch user: Instantly switch to any user account from the *Users* screen.
19
- * Switch back: Instantly switch back to your originating account.
20
- * Switch off: Log out of your account but retain the ability to instantly switch back in again.
21
- * It's completely secure (see the *Security* section below).
22
- * Compatible with WordPress, WordPress Multisite, BuddyPress and bbPress.
23
-
24
- = Security =
25
-
26
- * Only users with the ability to edit other users can switch user accounts. By default this is only Administrators on single site installs, and Super Admins on Multisite installs.
27
- * Passwords are not (and cannot be) revealed.
28
- * Implements WordPress' nonce security system, meaning only those who intend to switch users can switch.
29
- * Full support for administration over SSL (if applicable).
30
-
31
- = Usage =
32
-
33
- 1. Visit the *Users* menu in WordPress and you'll see a *Switch To* link next to each user.
34
- 2. Click this and you will immediately switch into that user account.
35
- 3. You can switch back to your originating account via the *Switch back* link on each dashboard screen or in your profile menu in the WordPress toolbar.
36
-
37
- See the [FAQ](http://wordpress.org/plugins/user-switching/faq/) for information about the *Switch Off* feature.
38
-
39
- = Translations Included =
40
-
41
- * Arabic by Hassan Hisham
42
- * Chinese Simplified by Tunghsiao Liu
43
- * Farsi (Persian) by Amin Ab
44
- * German by Ralph Stenzel
45
- * Japanese by Yusuke Hayasaki
46
- * Lithuanian by Tommixoft
47
- * Polish by Bartosz Arendt
48
- * Russian by R J
49
- * Slovak by Max Samael
50
-
51
- == Screenshots ==
52
-
53
- 1. ![The *Switch To* link on the Users screen](https://raw.github.com/johnbillion/user-switching/master/assets-wp-repo/screenshot-1.png)
54
- 2. ![The *Switch To* link on a user's profile](https://raw.github.com/johnbillion/user-switching/master/assets-wp-repo/screenshot-2.png)
55
-
56
- == Installation ==
57
-
58
- If you have the [WordPress Developer plugin](http://wordpress.org/plugins/developer/) installed then User Switching is a one-click install from the Tools -> Developer screen.
59
-
60
- Alternatively, you can install this plugin directly from your WordPress dashboard:
61
-
62
- 1. Go to the *Plugins* menu and click *Add New*.
63
- 2. Search for *User Switching*.
64
- 3. Click *Install Now* next to the *User Switching* plugin.
65
- 4. Activate the plugin.
66
-
67
- == Frequently Asked Questions ==
68
-
69
- = What does "Switch off" mean? =
70
-
71
- Switching off logs you out of your account but retains your user ID in an authorisation cookie so you can switch straight back without having to log in again manually. It's akin to switching to no user, and being able to switch back.
72
-
73
- The *Switch Off* link can be found in your profile menu in the WordPress toolbar. Once you've switched off you'll see a *Switch back* link in the footer of your site.
74
-
75
- = Does this plugin work with WordPress Multisite? =
76
-
77
- Yes, and you'll also be able to switch users from the Users screen in Network Admin.
78
-
79
- = Does this plugin work with BuddyPress? =
80
-
81
- Yes, and you'll also be able to switch users from member profile screens and the member listing screen.
82
-
83
- = Does this plugin work with bbPress? =
84
-
85
- Yes, and you'll also be able to switch users from member profile screens.
86
-
87
- = Does this work as a mu-plugin? =
88
-
89
- Yes, but you'll need to install `user-switching.php` into the root of your `mu-plugins` directory, not in the `user-switching` subdirectory. This is a restriction of WordPress.
90
-
91
- = What capability does a user need in order to switch accounts? =
92
-
93
- A user needs the `edit_users` capability in order to switch user accounts. By default only Administrators have this capability, and with Multisite enabled only Super Admins have this capability.
94
-
95
- = Can regular admins on Multisite installs switch accounts? =
96
-
97
- No. This can be enabled though by installing the [User Switching for Regular Admins](https://github.com/johnbillion/user-switching-for-regular-admins) plugin.
98
-
99
- = Are any plugin hooks called when users switch accounts? =
100
-
101
- Yes. When a user switches to another account, the `switch_to_user` hook is called with the new and old user IDs passed as parameters.
102
-
103
- When a user switches back to their original account, the `switch_back_user` hook is called with the new (original) and old user IDs passed as parameters. Note that the old user ID can be boolean false if the user is switching back after they've been switched off.
104
-
105
- When a user switches off, the `switch_off_user` hook is called with the old user ID as a parameter.
106
-
107
- == Upgrade Notice ==
108
-
109
- = 0.8.5 =
110
- * Add a 'Switch To' link to bbPress profile screens.
111
-
112
- == Changelog ==
113
-
114
- = 0.8.5 =
115
- * Add a 'Switch To' link to bbPress profile screens.
116
-
117
- = 0.8.4 =
118
- * Revert a change in 0.8.3 which switched to using the `login_init` hook. This hook is fired too late.
119
-
120
- = 0.8.3 =
121
- * Switch to storing data in cookies as JSON instead of PHP-serialized.
122
- * Show admin notices on all possible admin screens.
123
- * Tweak the redirect location for BuddyPress user profiles.
124
- * Change the textdomain in the plugin to match the plugin slug (required for language packs in WordPress core).
125
-
126
- = 0.8.2 =
127
- * Russian translation by R J
128
-
129
- = 0.8.1 =
130
- * Japanese translation by Yusuke Hayasaki
131
-
132
- = 0.8 =
133
- * Nested switching and switching back is now supported (capability permitting). Switch, switch again, switch back, switch back!
134
- * Fix for BuddyPress 1.7 member profile pages. Props nat0n.
135
- * Updated Arabic translation by Hassan Hisham.
136
- * A little code refactoring and improving, completed inline docs.
137
-
138
- = 0.7.1 =
139
- * Arabic translation by Hassan Hisham.
140
- * Minor code tweaks.
141
-
142
- = 0.7 =
143
- * Always show a 'Switch back' link in the footer when the admin toolbar isn't showing.
144
- * More intuitive redirecting after switching.
145
-
146
- = 0.6.3 =
147
- * Lithuanian translation by Tommixoft.
148
-
149
- = 0.6.2 =
150
- * Polish translation by Bartosz Arendt.
151
-
152
- = 0.6.1 =
153
- * Slovak translation by Max Samael.
154
-
155
- = 0.6 =
156
- * More intuitive redirecting after switching.
157
- * Avoid a BuddyPress bug preventing Switch To buttons from appearing.
158
- * Added a template function: `current_user_switched()` which lets you know if the current user switched into their account.
159
- * Added some hooks: `switch_to_user`, `switch_back_user` and `switch_off_user`, fired when appropriate.
160
-
161
- = 0.5.2 =
162
- * Farsi (Persian) translation by Amin Ab.
163
- * Display switch back links in Network Admin and login screen.
164
- * Avoid a BuddyPress bug preventing Switch To buttons from appearing.
165
-
166
- = 0.5.1.2 =
167
- * German translation by Ralph Stenzel.
168
-
169
- = 0.5.1.1 =
170
- * Chinese Simplified translation by Sparanoid.
171
-
172
- = 0.5.1 =
173
- * Toolbar tweaks for WordPress 3.3.
174
-
175
- = 0.5 =
176
- * New "Switch off" function: Log out and log instantly back in again when needed (see the FAQ).
177
-
178
- = 0.4.1 =
179
- * Support for upcoming changes to the admin bar in WordPress 3.3.
180
-
181
- = 0.4 =
182
- * Add some extended support for BuddyPress.
183
- * Add some extended support for Multisite.
184
- * Fix a permissions problem for users with no privileges.
185
- * Fix a PHP warning when used as a mu-plugin (thanks Scribu).
186
-
187
- = 0.3.2 =
188
- * Fix the 'Switch back to' menu item in the WordPress admin bar (WordPress 3.1+).
189
- * Fix a formatting issue on the user profile page.
190
-
191
- = 0.3.1 =
192
- * Prevent admins switching to multisite super admin accounts.
193
-
194
- = 0.3 =
195
- * Adds an admin bar menu item (WordPress 3.1+) for switching back to the user you switched from.
196
-
197
- = 0.2.2 =
198
- * Respect the current 'Remember me' setting when switching users.
199
- * Redirect to home page instead of admin screen if the user you're switching to has no privileges.
200
-
201
- = 0.2.1 =
202
- * Edge case bugfix to prevent 'Switch back to...' message appearing when it shouldn't.
203
-
204
- = 0.2 =
205
- * Functionality for switching back to user you switched from.
206
-
207
- = 0.1 =
208
- * Initial release.
 
 
 
1
+ === User Switching ===
2
+
3
+ Contributors: johnbillion
4
+ Tags: user, users, profiles, switching, wpmu, multisite, buddypress, bbpress, become, user control, user management, user access, developer
5
+ Requires at least: 3.1
6
+ Tested up to: 3.8
7
+ Stable tag: 0.8.6
8
+ License: GPL v2 or later
9
+
10
+ Instant switching between user accounts in WordPress.
11
+
12
+ == Description ==
13
+
14
+ This plugin allows you to quickly swap between user accounts in WordPress at the click of a button. You'll be instantly logged out and logged in as your desired user. This is handy for test environments where you regularly log out and in between different accounts, or for adminstrators who need to switch between multiple accounts.
15
+
16
+ = Features =
17
+
18
+ * Switch user: Instantly switch to any user account from the *Users* screen.
19
+ * Switch back: Instantly switch back to your originating account.
20
+ * Switch off: Log out of your account but retain the ability to instantly switch back in again.
21
+ * It's completely secure (see the *Security* section below).
22
+ * Compatible with WordPress, WordPress Multisite, BuddyPress and bbPress.
23
+
24
+ = Security =
25
+
26
+ * Only users with the ability to edit other users can switch user accounts. By default this is only Administrators on single site installs, and Super Admins on Multisite installs.
27
+ * Passwords are not (and cannot be) revealed.
28
+ * Implements WordPress' nonce security system, meaning only those who intend to switch users can switch.
29
+ * Full support for administration over SSL (if applicable).
30
+
31
+ = Usage =
32
+
33
+ 1. Visit the *Users* menu in WordPress and you'll see a *Switch To* link next to each user.
34
+ 2. Click this and you will immediately switch into that user account.
35
+ 3. You can switch back to your originating account via the *Switch back* link on each dashboard screen or in your profile menu in the WordPress toolbar.
36
+
37
+ See the [FAQ](http://wordpress.org/plugins/user-switching/faq/) for information about the *Switch Off* feature.
38
+
39
+ = Translations Included =
40
+
41
+ * Arabic by Hassan Hisham
42
+ * Chinese Simplified by Tunghsiao Liu
43
+ * Farsi (Persian) by Amin Ab
44
+ * German by Ralph Stenzel
45
+ * Japanese by Yusuke Hayasaki
46
+ * Lithuanian by Tommixoft
47
+ * Polish by Bartosz Arendt
48
+ * Russian by R J
49
+ * Slovak by Max Samael
50
+
51
+ == Screenshots ==
52
+
53
+ 1. ![The *Switch To* link on the Users screen](https://raw.github.com/johnbillion/user-switching/master/assets-wp-repo/screenshot-1.png)
54
+ 2. ![The *Switch To* link on a user's profile](https://raw.github.com/johnbillion/user-switching/master/assets-wp-repo/screenshot-2.png)
55
+
56
+ == Installation ==
57
+
58
+ If you have the [WordPress Developer plugin](http://wordpress.org/plugins/developer/) installed then User Switching is a one-click install from the Tools -> Developer screen.
59
+
60
+ Alternatively, you can install this plugin directly from your WordPress dashboard:
61
+
62
+ 1. Go to the *Plugins* menu and click *Add New*.
63
+ 2. Search for *User Switching*.
64
+ 3. Click *Install Now* next to the *User Switching* plugin.
65
+ 4. Activate the plugin.
66
+
67
+ == Frequently Asked Questions ==
68
+
69
+ = What does "Switch off" mean? =
70
+
71
+ Switching off logs you out of your account but retains your user ID in an authorisation cookie so you can switch straight back without having to log in again manually. It's akin to switching to no user, and being able to switch back.
72
+
73
+ The *Switch Off* link can be found in your profile menu in the WordPress toolbar. Once you've switched off you'll see a *Switch back* link in the footer of your site.
74
+
75
+ = Does this plugin work with WordPress Multisite? =
76
+
77
+ Yes, and you'll also be able to switch users from the Users screen in Network Admin.
78
+
79
+ = Does this plugin work with BuddyPress? =
80
+
81
+ Yes, and you'll also be able to switch users from member profile screens and the member listing screen.
82
+
83
+ = Does this plugin work with bbPress? =
84
+
85
+ Yes, and you'll also be able to switch users from member profile screens.
86
+
87
+ = Does this work as a mu-plugin? =
88
+
89
+ Yes, but you'll need to install `user-switching.php` into the root of your `mu-plugins` directory, not in the `user-switching` subdirectory. This is a restriction of WordPress.
90
+
91
+ = What capability does a user need in order to switch accounts? =
92
+
93
+ A user needs the `edit_users` capability in order to switch user accounts. By default only Administrators have this capability, and with Multisite enabled only Super Admins have this capability.
94
+
95
+ = Can regular admins on Multisite installs switch accounts? =
96
+
97
+ No. This can be enabled though by installing the [User Switching for Regular Admins](https://github.com/johnbillion/user-switching-for-regular-admins) plugin.
98
+
99
+ = Are any plugin hooks called when users switch accounts? =
100
+
101
+ Yes. When a user switches to another account, the `switch_to_user` hook is called with the new and old user IDs passed as parameters.
102
+
103
+ When a user switches back to their original account, the `switch_back_user` hook is called with the new (original) and old user IDs passed as parameters. Note that the old user ID can be boolean false if the user is switching back after they've been switched off.
104
+
105
+ When a user switches off, the `switch_off_user` hook is called with the old user ID as a parameter.
106
+
107
+ == Upgrade Notice ==
108
+
109
+ = 0.8.6 =
110
+ * Correctly encode the `redirect_to` parameter in the login screen message.
111
+
112
+ == Changelog ==
113
+
114
+ = 0.8.6 =
115
+ * Correctly encode the `redirect_to` parameter in the login screen message.
116
+
117
+ = 0.8.5 =
118
+ * Add a 'Switch To' link to bbPress profile screens.
119
+
120
+ = 0.8.4 =
121
+ * Revert a change in 0.8.3 which switched to using the `login_init` hook. This hook is fired too late.
122
+
123
+ = 0.8.3 =
124
+ * Switch to storing data in cookies as JSON instead of PHP-serialized.
125
+ * Show admin notices on all possible admin screens.
126
+ * Tweak the redirect location for BuddyPress user profiles.
127
+ * Change the textdomain in the plugin to match the plugin slug (required for language packs in WordPress core).
128
+
129
+ = 0.8.2 =
130
+ * Russian translation by R J
131
+
132
+ = 0.8.1 =
133
+ * Japanese translation by Yusuke Hayasaki
134
+
135
+ = 0.8 =
136
+ * Nested switching and switching back is now supported (capability permitting). Switch, switch again, switch back, switch back!
137
+ * Fix for BuddyPress 1.7 member profile pages. Props nat0n.
138
+ * Updated Arabic translation by Hassan Hisham.
139
+ * A little code refactoring and improving, completed inline docs.
140
+
141
+ = 0.7.1 =
142
+ * Arabic translation by Hassan Hisham.
143
+ * Minor code tweaks.
144
+
145
+ = 0.7 =
146
+ * Always show a 'Switch back' link in the footer when the admin toolbar isn't showing.
147
+ * More intuitive redirecting after switching.
148
+
149
+ = 0.6.3 =
150
+ * Lithuanian translation by Tommixoft.
151
+
152
+ = 0.6.2 =
153
+ * Polish translation by Bartosz Arendt.
154
+
155
+ = 0.6.1 =
156
+ * Slovak translation by Max Samael.
157
+
158
+ = 0.6 =
159
+ * More intuitive redirecting after switching.
160
+ * Avoid a BuddyPress bug preventing Switch To buttons from appearing.
161
+ * Added a template function: `current_user_switched()` which lets you know if the current user switched into their account.
162
+ * Added some hooks: `switch_to_user`, `switch_back_user` and `switch_off_user`, fired when appropriate.
163
+
164
+ = 0.5.2 =
165
+ * Farsi (Persian) translation by Amin Ab.
166
+ * Display switch back links in Network Admin and login screen.
167
+ * Avoid a BuddyPress bug preventing Switch To buttons from appearing.
168
+
169
+ = 0.5.1.2 =
170
+ * German translation by Ralph Stenzel.
171
+
172
+ = 0.5.1.1 =
173
+ * Chinese Simplified translation by Sparanoid.
174
+
175
+ = 0.5.1 =
176
+ * Toolbar tweaks for WordPress 3.3.
177
+
178
+ = 0.5 =
179
+ * New "Switch off" function: Log out and log instantly back in again when needed (see the FAQ).
180
+
181
+ = 0.4.1 =
182
+ * Support for upcoming changes to the admin bar in WordPress 3.3.
183
+
184
+ = 0.4 =
185
+ * Add some extended support for BuddyPress.
186
+ * Add some extended support for Multisite.
187
+ * Fix a permissions problem for users with no privileges.
188
+ * Fix a PHP warning when used as a mu-plugin (thanks Scribu).
189
+
190
+ = 0.3.2 =
191
+ * Fix the 'Switch back to' menu item in the WordPress admin bar (WordPress 3.1+).
192
+ * Fix a formatting issue on the user profile page.
193
+
194
+ = 0.3.1 =
195
+ * Prevent admins switching to multisite super admin accounts.
196
+
197
+ = 0.3 =
198
+ * Adds an admin bar menu item (WordPress 3.1+) for switching back to the user you switched from.
199
+
200
+ = 0.2.2 =
201
+ * Respect the current 'Remember me' setting when switching users.
202
+ * Redirect to home page instead of admin screen if the user you're switching to has no privileges.
203
+
204
+ = 0.2.1 =
205
+ * Edge case bugfix to prevent 'Switch back to...' message appearing when it shouldn't.
206
+
207
+ = 0.2 =
208
+ * Functionality for switching back to user you switched from.
209
+
210
+ = 0.1 =
211
+ * Initial release.
user-switching.php CHANGED
@@ -2,7 +2,7 @@
2
  /*
3
  Plugin Name: User Switching
4
  Description: Instant switching between user accounts in WordPress
5
- Version: 0.8.5
6
  Plugin URI: https://lud.icro.us/wordpress-plugin-user-switching/
7
  Author: John Blackbourn
8
  Author URI: https://johnblackbourn.com/
@@ -10,7 +10,7 @@ Text Domain: user-switching
10
  Domain Path: /languages/
11
  License: GPL v2 or later
12
 
13
- Copyright © 2013 John Blackbourn
14
 
15
  This program is free software; you can redistribute it and/or modify
16
  it under the terms of the GNU General Public License as published by
@@ -320,7 +320,7 @@ class user_switching {
320
  $url = self::switch_back_url();
321
  if ( isset( $_REQUEST['redirect_to'] ) and !empty( $_REQUEST['redirect_to'] ) ) {
322
  $url = add_query_arg( array(
323
- 'redirect_to' => $_REQUEST['redirect_to']
324
  ), $url );
325
  }
326
  $message .= '<p class="message"><a href="' . $url . '">' . $link . '</a></p>';
2
  /*
3
  Plugin Name: User Switching
4
  Description: Instant switching between user accounts in WordPress
5
+ Version: 0.8.6
6
  Plugin URI: https://lud.icro.us/wordpress-plugin-user-switching/
7
  Author: John Blackbourn
8
  Author URI: https://johnblackbourn.com/
10
  Domain Path: /languages/
11
  License: GPL v2 or later
12
 
13
+ Copyright © 2014 John Blackbourn
14
 
15
  This program is free software; you can redistribute it and/or modify
16
  it under the terms of the GNU General Public License as published by
320
  $url = self::switch_back_url();
321
  if ( isset( $_REQUEST['redirect_to'] ) and !empty( $_REQUEST['redirect_to'] ) ) {
322
  $url = add_query_arg( array(
323
+ 'redirect_to' => urlencode( $_REQUEST['redirect_to'] )
324
  ), $url );
325
  }
326
  $message .= '<p class="message"><a href="' . $url . '">' . $link . '</a></p>';