User Switching - Version 1.0.1

Version Description

  • Shorten the names of User Switching's cookies to avoid problems with Suhosin's over-zealous default rules.
  • Add backwards compatibility for the deprecated OLDUSER_COOKIE constant.
Download this release

Release Info

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

Code changes from version 1.0 to 1.0.1

Files changed (3) hide show
  1. phpunit-ms.xml +0 -17
  2. readme.txt +12 -2
  3. user-switching.php +15 -5
phpunit-ms.xml DELETED
@@ -1,17 +0,0 @@
1
- <phpunit
2
- bootstrap="tests/bootstrap.php"
3
- backupGlobals="false"
4
- colors="true"
5
- convertErrorsToExceptions="true"
6
- convertNoticesToExceptions="true"
7
- convertWarningsToExceptions="true"
8
- >
9
- <php>
10
- <const name="WP_TESTS_MULTISITE" value="1" />
11
- </php>
12
- <testsuites>
13
- <testsuite>
14
- <directory prefix="test-" suffix=".php">./tests/</directory>
15
- </testsuite>
16
- </testsuites>
17
- </phpunit>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
readme.txt CHANGED
@@ -4,7 +4,7 @@ Contributors: johnbillion
4
  Tags: users, profiles, user switching, fast user switching, multisite, buddypress, bbpress, become, user management, developer
5
  Requires at least: 3.1
6
  Tested up to: 4.0
7
- Stable tag: 1.0
8
  License: GPL v2 or later
9
 
10
  Instant switching between user accounts in WordPress.
@@ -76,7 +76,7 @@ Alternatively, you can install this plugin directly from your WordPress dashboar
76
 
77
  = What does "Switch off" mean? =
78
 
79
- 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.
80
 
81
  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.
82
 
@@ -114,12 +114,22 @@ When a user switches off, the `switch_off_user` hook is called with the old user
114
 
115
  == Upgrade Notice ==
116
 
 
 
 
 
 
117
  = 1.0 =
118
 
119
  * Security hardening for sites that use HTTPS in the admin area and HTTP on the front end.
120
 
121
  == Changelog ==
122
 
 
 
 
 
 
123
  = 1.0 =
124
 
125
  * Security hardening for sites that use HTTPS in the admin area and HTTP on the front end.
4
  Tags: users, profiles, user switching, fast user switching, multisite, buddypress, bbpress, become, user management, developer
5
  Requires at least: 3.1
6
  Tested up to: 4.0
7
+ Stable tag: 1.0.1
8
  License: GPL v2 or later
9
 
10
  Instant switching between user accounts in WordPress.
76
 
77
  = What does "Switch off" mean? =
78
 
79
+ Switching off logs you out of your account but retains your user ID in an authentication 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.
80
 
81
  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.
82
 
114
 
115
  == Upgrade Notice ==
116
 
117
+ = 1.0.1 =
118
+
119
+ * Shorten the names of User Switching's cookies to avoid problems with Suhosin's over-zealous default rules.
120
+ * Add backwards compatibility for the deprecated `OLDUSER_COOKIE` constant.
121
+
122
  = 1.0 =
123
 
124
  * Security hardening for sites that use HTTPS in the admin area and HTTP on the front end.
125
 
126
  == Changelog ==
127
 
128
+ = 1.0.1 =
129
+
130
+ * Shorten the names of User Switching's cookies to avoid problems with Suhosin's over-zealous default rules.
131
+ * Add backwards compatibility for the deprecated `OLDUSER_COOKIE` constant.
132
+
133
  = 1.0 =
134
 
135
  * Security hardening for sites that use HTTPS in the admin area and HTTP on the front end.
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: 1.0
6
  Plugin URI: https://johnblackbourn.com/wordpress-plugin-user-switching/
7
  Author: John Blackbourn
8
  Author URI: https://johnblackbourn.com/
@@ -55,21 +55,31 @@ class user_switching {
55
  }
56
 
57
  /**
58
- * Define the names of our cookies. Uses WordPress' cookie hash for increased security.
59
  */
60
  public function action_plugins_loaded() {
61
 
62
  // User Switching's auth_cookie
63
  if ( !defined( 'USER_SWITCHING_COOKIE' ) ) {
64
- define( 'USER_SWITCHING_COOKIE', 'wordpress_user_switching_' . COOKIEHASH );
65
  }
 
66
  // User Switching's secure_auth_cookie
67
  if ( !defined( 'USER_SWITCHING_SECURE_COOKIE' ) ) {
68
- define( 'USER_SWITCHING_SECURE_COOKIE', 'wordpress_user_switching_secure_' . COOKIEHASH );
69
  }
 
70
  // User Switching's logged_in_cookie
71
  if ( !defined( 'USER_SWITCHING_OLDUSER_COOKIE' ) ) {
72
- define( 'USER_SWITCHING_OLDUSER_COOKIE', 'wordpress_user_switching_olduser_' . COOKIEHASH );
 
 
 
 
 
 
 
 
73
  }
74
 
75
  }
2
  /*
3
  Plugin Name: User Switching
4
  Description: Instant switching between user accounts in WordPress
5
+ Version: 1.0.1
6
  Plugin URI: https://johnblackbourn.com/wordpress-plugin-user-switching/
7
  Author: John Blackbourn
8
  Author URI: https://johnblackbourn.com/
55
  }
56
 
57
  /**
58
+ * Define the names of our cookies.
59
  */
60
  public function action_plugins_loaded() {
61
 
62
  // User Switching's auth_cookie
63
  if ( !defined( 'USER_SWITCHING_COOKIE' ) ) {
64
+ define( 'USER_SWITCHING_COOKIE', 'wordpress_user_sw_' . COOKIEHASH );
65
  }
66
+
67
  // User Switching's secure_auth_cookie
68
  if ( !defined( 'USER_SWITCHING_SECURE_COOKIE' ) ) {
69
+ define( 'USER_SWITCHING_SECURE_COOKIE', 'wordpress_user_sw_secure_' . COOKIEHASH );
70
  }
71
+
72
  // User Switching's logged_in_cookie
73
  if ( !defined( 'USER_SWITCHING_OLDUSER_COOKIE' ) ) {
74
+ if ( defined( 'OLDUSER_COOKIE' ) ) {
75
+ trigger_error( sprintf(
76
+ 'The OLDUSER_COOKIE constant is deprecated. See <code>%s()</code>.',
77
+ __METHOD__
78
+ ), ( WP_DEBUG ? E_USER_WARNING : E_USER_NOTICE ) );
79
+ define( 'USER_SWITCHING_OLDUSER_COOKIE', OLDUSER_COOKIE );
80
+ } else {
81
+ define( 'USER_SWITCHING_OLDUSER_COOKIE', 'wordpress_user_sw_olduser_' . COOKIEHASH );
82
+ }
83
  }
84
 
85
  }