User Switching - Version 0.9

Version Description

  • Minor fixes for the login_redirect filter.

=

Download this release

Release Info

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

Code changes from version 0.8.9 to 0.9

Files changed (3) hide show
  1. phpunit-ms.xml +17 -0
  2. readme.txt +16 -10
  3. user-switching.php +47 -48
phpunit-ms.xml ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
@@ -1,10 +1,10 @@
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.9
7
- Stable tag: 0.8.9
8
  License: GPL v2 or later
9
 
10
  Instant switching between user accounts in WordPress.
@@ -113,16 +113,22 @@ When a user switches off, the `switch_off_user` hook is called with the old user
113
 
114
  == Upgrade Notice ==
115
 
116
- = 0.8.9 =
117
- * Translations for French, Hebrew, Indonesian, and Portuguese.
 
118
 
119
  == Changelog ==
120
 
 
 
 
 
 
121
  = 0.8.9 =
122
- * French translation by Fx Bénard
123
- * Hebrew translation by Rami Y
124
- * Indonesian translation by Eko Ikhyar
125
- * Portuguese translation by Raphael Mendonça
126
 
127
  = 0.8.8 =
128
  * Spanish Translation by Marcelo Pedra.
@@ -147,10 +153,10 @@ When a user switches off, the `switch_off_user` hook is called with the old user
147
  * Change the textdomain in the plugin to match the plugin slug (required for language packs in WordPress core).
148
 
149
  = 0.8.2 =
150
- * Russian translation by R J
151
 
152
  = 0.8.1 =
153
- * Japanese translation by Yusuke Hayasaki
154
 
155
  = 0.8 =
156
  * Nested switching and switching back is now supported (capability permitting). Switch, switch again, switch back, switch back!
1
  === User Switching ===
2
 
3
  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: 3.9
7
+ Stable tag: 0.9
8
  License: GPL v2 or later
9
 
10
  Instant switching between user accounts in WordPress.
113
 
114
  == Upgrade Notice ==
115
 
116
+ = 0.9 =
117
+
118
+ * Minor fixes for the `login_redirect` filter.
119
 
120
  == Changelog ==
121
 
122
+ = 0.9 =
123
+
124
+ * Minor fixes for the `login_redirect` filter.
125
+ * Increase the specificity of the `switch_to_old_user` and `switch_off` nonces.
126
+
127
  = 0.8.9 =
128
+ * French translation by Fx Bénard.
129
+ * Hebrew translation by Rami Y.
130
+ * Indonesian translation by Eko Ikhyar.
131
+ * Portuguese translation by Raphael Mendonça.
132
 
133
  = 0.8.8 =
134
  * Spanish Translation by Marcelo Pedra.
153
  * Change the textdomain in the plugin to match the plugin slug (required for language packs in WordPress core).
154
 
155
  = 0.8.2 =
156
+ * Russian translation by R J.
157
 
158
  = 0.8.1 =
159
+ * Japanese translation by Yusuke Hayasaki.
160
 
161
  = 0.8 =
162
  * Nested switching and switching back is now supported (capability permitting). Switch, switch again, switch back, switch back!
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.9
6
  Plugin URI: https://johnblackbourn.com/wordpress-plugin-user-switching/
7
  Author: John Blackbourn
8
  Author URI: https://johnblackbourn.com/
@@ -57,7 +57,6 @@ class user_switching {
57
  /**
58
  * Define the name of the old user cookie. Uses WordPress' cookie hash for increased security.
59
  *
60
- * @return null
61
  */
62
  public function action_plugins_loaded() {
63
  if ( !defined( 'OLDUSER_COOKIE' ) ) {
@@ -69,11 +68,10 @@ class user_switching {
69
  * Output the 'Switch To' link on the user editing screen if we have permission to switch to this user.
70
  *
71
  * @param WP_User $user User object for this screen
72
- * @return null
73
  */
74
  public function action_personal_options( WP_User $user ) {
75
 
76
- if ( ! $link = self::maybe_switch_url( $user->ID ) ) {
77
  return;
78
  }
79
 
@@ -106,7 +104,6 @@ class user_switching {
106
  /**
107
  * Load localisation files and route actions depending on the 'action' query var.
108
  *
109
- * @return null
110
  */
111
  public function action_init() {
112
 
@@ -148,17 +145,17 @@ class user_switching {
148
  # We're attempting to switch back to the originating user:
149
  case 'switch_to_olduser':
150
 
151
- check_admin_referer( 'switch_to_olduser' );
152
-
153
  # Fetch the originating user data:
154
  if ( !$old_user = self::get_old_user() ) {
155
  wp_die( __( 'Could not switch users.', 'user-switching' ) );
156
  }
157
 
 
 
158
  # Switch user:
159
  if ( switch_to_user( $old_user->ID, self::remember(), false ) ) {
160
 
161
- $redirect_to = self::get_redirect();
162
 
163
  if ( $redirect_to ) {
164
  wp_safe_redirect( add_query_arg( array( 'user_switched' => 'true', 'switched_back' => 'true' ), $redirect_to ) );
@@ -174,7 +171,9 @@ class user_switching {
174
  # We're attempting to switch off the current user:
175
  case 'switch_off':
176
 
177
- check_admin_referer( 'switch_off' );
 
 
178
 
179
  # Switch off:
180
  if ( switch_off_user() ) {
@@ -209,7 +208,8 @@ class user_switching {
209
  }
210
 
211
  if ( $user ) {
212
- $redirect_to = apply_filters( 'login_redirect', $redirect_to, $redirect_to, $user );
 
213
  }
214
 
215
  return $redirect_to;
@@ -219,7 +219,6 @@ class user_switching {
219
  /**
220
  * Display the 'Switched to {user}' and 'Switch back to {user}' messages in the admin area.
221
  *
222
- * @return null
223
  */
224
  public function action_admin_notices() {
225
  $user = wp_get_current_user();
@@ -234,7 +233,7 @@ class user_switching {
234
  }
235
  $url = add_query_arg( array(
236
  'redirect_to' => urlencode( self::current_url() )
237
- ), self::switch_back_url() );
238
  printf( ' <a href="%s">%s</a>.', $url, sprintf( __( 'Switch back to %1$s (%2$s)', 'user-switching' ), $old_user->display_name, $old_user->user_login ) );
239
  ?></p>
240
  </div>
@@ -276,7 +275,6 @@ class user_switching {
276
  * Adds a 'Switch back to {user}' link to the account menu in WordPress' admin bar.
277
  *
278
  * @param WP_Admin_Bar $wp_admin_bar The admin bar object
279
- * @return null
280
  */
281
  public function action_admin_bar_menu( WP_Admin_Bar $wp_admin_bar ) {
282
 
@@ -303,14 +301,14 @@ class user_switching {
303
  'title' => sprintf( __( 'Switch back to %1$s (%2$s)', 'user-switching' ), $old_user->display_name, $old_user->user_login ),
304
  'href' => add_query_arg( array(
305
  'redirect_to' => urlencode( self::current_url() )
306
- ), self::switch_back_url() )
307
  ) );
308
 
309
  }
310
 
311
  if ( current_user_can( 'switch_off' ) ) {
312
 
313
- $url = self::switch_off_url();
314
  if ( !is_admin() ) {
315
  $url = add_query_arg( array(
316
  'redirect_to' => urlencode( self::current_url() )
@@ -331,7 +329,6 @@ class user_switching {
331
  /**
332
  * Adds a 'Switch back to {user}' link to the WordPress footer if the admin toolbar isn't showing.
333
  *
334
- * @return null
335
  */
336
  public function action_wp_footer() {
337
 
@@ -339,7 +336,7 @@ class user_switching {
339
  $link = sprintf( __( 'Switch back to %1$s (%2$s)', 'user-switching' ), $old_user->display_name, $old_user->user_login );
340
  $url = add_query_arg( array(
341
  'redirect_to' => urlencode( self::current_url() )
342
- ), self::switch_back_url() );
343
  echo '<p id="user_switching_switch_on"><a href="' . $url . '">' . $link . '</a></p>';
344
  }
345
 
@@ -355,7 +352,7 @@ class user_switching {
355
 
356
  if ( $old_user = self::get_old_user() ) {
357
  $link = sprintf( __( 'Switch back to %1$s (%2$s)', 'user-switching' ), $old_user->display_name, $old_user->user_login );
358
- $url = self::switch_back_url();
359
  if ( isset( $_REQUEST['redirect_to'] ) and !empty( $_REQUEST['redirect_to'] ) ) {
360
  $url = add_query_arg( array(
361
  'redirect_to' => urlencode( $_REQUEST['redirect_to'] )
@@ -377,7 +374,7 @@ class user_switching {
377
  */
378
  public function filter_user_row_actions( array $actions, WP_User $user ) {
379
 
380
- if ( ! $link = self::maybe_switch_url( $user->ID ) ) {
381
  return $actions;
382
  }
383
 
@@ -389,24 +386,26 @@ class user_switching {
389
  /**
390
  * Adds a 'Switch To' link to each member's profile page and profile listings in BuddyPress.
391
  *
392
- * @return null
393
  */
394
  public function action_bp_button() {
395
 
396
  global $bp, $members_template;
397
 
398
  if ( !empty( $members_template ) and empty( $bp->displayed_user->id ) ) {
399
- $id = absint( $members_template->member->id );
400
  } else {
401
- $id = absint( $bp->displayed_user->id );
402
  }
403
 
404
- if ( ! $link = self::maybe_switch_url( $id ) ) {
 
 
 
405
  return;
406
  }
407
 
408
  $link = add_query_arg( array(
409
- 'redirect_to' => urlencode( bp_core_get_user_domain( $id ) )
410
  ), $link );
411
 
412
  # Workaround for https://buddypress.trac.wordpress.org/ticket/4212
@@ -429,18 +428,18 @@ class user_switching {
429
  /**
430
  * Adds a 'Switch To' link to each member's profile page in bbPress.
431
  *
432
- * @return null
433
  */
434
  public function action_bbpress_button() {
435
 
436
- $id = bbp_get_user_id();
437
-
438
- if ( ! $link = self::maybe_switch_url( $id ) ) {
 
439
  return;
440
  }
441
 
442
  $link = add_query_arg( array(
443
- 'redirect_to' => urlencode( bbp_get_user_profile_url( $id ) )
444
  ), $link );
445
 
446
  ?>
@@ -452,19 +451,19 @@ class user_switching {
452
  }
453
 
454
  /**
455
- * Helper function. Returns the switch to or switch back URL for a given user ID.
456
  *
457
- * @param int $user_id The user ID to be switched to.
458
  * @return string|bool The required URL, or false if there's no old user or the user doesn't have the required capability.
459
  */
460
- public static function maybe_switch_url( $user_id ) {
461
 
462
  $old_user = self::get_old_user();
463
 
464
- if ( $old_user and ( $old_user->ID == $user_id ) ) {
465
- return self::switch_back_url();
466
- } else if ( current_user_can( 'switch_to_user', $user_id ) ) {
467
- return self::switch_to_url( $user_id );
468
  } else {
469
  return false;
470
  }
@@ -474,36 +473,38 @@ class user_switching {
474
  /**
475
  * Helper function. Returns the nonce-secured URL needed to switch to a given user ID.
476
  *
477
- * @param int $user_id The user ID to be switched to.
478
  * @return string The required URL
479
  */
480
- public static function switch_to_url( $user_id ) {
481
  return wp_nonce_url( add_query_arg( array(
482
  'action' => 'switch_to_user',
483
- 'user_id' => $user_id
484
- ), wp_login_url() ), "switch_to_user_{$user_id}" );
485
  }
486
 
487
  /**
488
  * Helper function. Returns the nonce-secured URL needed to switch back to the originating user.
489
  *
 
490
  * @return string The required URL
491
  */
492
- public static function switch_back_url() {
493
  return wp_nonce_url( add_query_arg( array(
494
  'action' => 'switch_to_olduser'
495
- ), wp_login_url() ), 'switch_to_olduser' );
496
  }
497
 
498
  /**
499
  * Helper function. Returns the nonce-secured URL needed to switch off the current user.
500
  *
 
501
  * @return string The required URL
502
  */
503
- public static function switch_off_url() {
504
  return wp_nonce_url( add_query_arg( array(
505
  'action' => 'switch_off'
506
- ), wp_login_url() ), 'switch_off' );
507
  }
508
 
509
  /**
@@ -524,8 +525,8 @@ class user_switching {
524
  public static function remove_query_args( $url ) {
525
  return remove_query_arg( array(
526
  'user_switched', 'switched_off', 'switched_back',
527
- 'message', 'updated', 'settings-updated', 'saved',
528
- 'activated', 'activate', 'deactivate',
529
  'locked', 'skipped', 'deleted', 'trashed', 'untrashed'
530
  ), $url );
531
  }
@@ -581,7 +582,6 @@ class user_switching {
581
  * Sets an authorisation cookie containing the originating user, or appends it if there's more than one.
582
  *
583
  * @param int $old_user_id The ID of the originating user, usually the current logged in user.
584
- * @return null
585
  */
586
  if ( !function_exists( 'wp_set_olduser_cookie' ) ) {
587
  function wp_set_olduser_cookie( $old_user_id ) {
@@ -597,7 +597,6 @@ function wp_set_olduser_cookie( $old_user_id ) {
597
  * Clears the cookie containing the originating user, or pops the latest item off the end if there's more than one.
598
  *
599
  * @param bool $clear_all Whether to clear the cookie or just pop the last user information off the end.
600
- * @return null
601
  */
602
  if ( !function_exists( 'wp_clear_olduser_cookie' ) ) {
603
  function wp_clear_olduser_cookie( $clear_all = true ) {
2
  /*
3
  Plugin Name: User Switching
4
  Description: Instant switching between user accounts in WordPress
5
+ Version: 0.9
6
  Plugin URI: https://johnblackbourn.com/wordpress-plugin-user-switching/
7
  Author: John Blackbourn
8
  Author URI: https://johnblackbourn.com/
57
  /**
58
  * Define the name of the old user cookie. Uses WordPress' cookie hash for increased security.
59
  *
 
60
  */
61
  public function action_plugins_loaded() {
62
  if ( !defined( 'OLDUSER_COOKIE' ) ) {
68
  * Output the 'Switch To' link on the user editing screen if we have permission to switch to this user.
69
  *
70
  * @param WP_User $user User object for this screen
 
71
  */
72
  public function action_personal_options( WP_User $user ) {
73
 
74
+ if ( ! $link = self::maybe_switch_url( $user ) ) {
75
  return;
76
  }
77
 
104
  /**
105
  * Load localisation files and route actions depending on the 'action' query var.
106
  *
 
107
  */
108
  public function action_init() {
109
 
145
  # We're attempting to switch back to the originating user:
146
  case 'switch_to_olduser':
147
 
 
 
148
  # Fetch the originating user data:
149
  if ( !$old_user = self::get_old_user() ) {
150
  wp_die( __( 'Could not switch users.', 'user-switching' ) );
151
  }
152
 
153
+ check_admin_referer( "switch_to_olduser_{$old_user->ID}" );
154
+
155
  # Switch user:
156
  if ( switch_to_user( $old_user->ID, self::remember(), false ) ) {
157
 
158
+ $redirect_to = self::get_redirect( $old_user );
159
 
160
  if ( $redirect_to ) {
161
  wp_safe_redirect( add_query_arg( array( 'user_switched' => 'true', 'switched_back' => 'true' ), $redirect_to ) );
171
  # We're attempting to switch off the current user:
172
  case 'switch_off':
173
 
174
+ $user = wp_get_current_user();
175
+
176
+ check_admin_referer( "switch_off_{$user->ID}" );
177
 
178
  # Switch off:
179
  if ( switch_off_user() ) {
208
  }
209
 
210
  if ( $user ) {
211
+ $requested_redirect_to = isset( $_REQUEST['redirect_to'] ) ? $_REQUEST['redirect_to'] : '';
212
+ $redirect_to = apply_filters( 'login_redirect', $redirect_to, $requested_redirect_to, $user );
213
  }
214
 
215
  return $redirect_to;
219
  /**
220
  * Display the 'Switched to {user}' and 'Switch back to {user}' messages in the admin area.
221
  *
 
222
  */
223
  public function action_admin_notices() {
224
  $user = wp_get_current_user();
233
  }
234
  $url = add_query_arg( array(
235
  'redirect_to' => urlencode( self::current_url() )
236
+ ), self::switch_back_url( $old_user ) );
237
  printf( ' <a href="%s">%s</a>.', $url, sprintf( __( 'Switch back to %1$s (%2$s)', 'user-switching' ), $old_user->display_name, $old_user->user_login ) );
238
  ?></p>
239
  </div>
275
  * Adds a 'Switch back to {user}' link to the account menu in WordPress' admin bar.
276
  *
277
  * @param WP_Admin_Bar $wp_admin_bar The admin bar object
 
278
  */
279
  public function action_admin_bar_menu( WP_Admin_Bar $wp_admin_bar ) {
280
 
301
  'title' => sprintf( __( 'Switch back to %1$s (%2$s)', 'user-switching' ), $old_user->display_name, $old_user->user_login ),
302
  'href' => add_query_arg( array(
303
  'redirect_to' => urlencode( self::current_url() )
304
+ ), self::switch_back_url( $old_user ) )
305
  ) );
306
 
307
  }
308
 
309
  if ( current_user_can( 'switch_off' ) ) {
310
 
311
+ $url = self::switch_off_url( wp_get_current_user() );
312
  if ( !is_admin() ) {
313
  $url = add_query_arg( array(
314
  'redirect_to' => urlencode( self::current_url() )
329
  /**
330
  * Adds a 'Switch back to {user}' link to the WordPress footer if the admin toolbar isn't showing.
331
  *
 
332
  */
333
  public function action_wp_footer() {
334
 
336
  $link = sprintf( __( 'Switch back to %1$s (%2$s)', 'user-switching' ), $old_user->display_name, $old_user->user_login );
337
  $url = add_query_arg( array(
338
  'redirect_to' => urlencode( self::current_url() )
339
+ ), self::switch_back_url( $old_user ) );
340
  echo '<p id="user_switching_switch_on"><a href="' . $url . '">' . $link . '</a></p>';
341
  }
342
 
352
 
353
  if ( $old_user = self::get_old_user() ) {
354
  $link = sprintf( __( 'Switch back to %1$s (%2$s)', 'user-switching' ), $old_user->display_name, $old_user->user_login );
355
+ $url = self::switch_back_url( $old_user );
356
  if ( isset( $_REQUEST['redirect_to'] ) and !empty( $_REQUEST['redirect_to'] ) ) {
357
  $url = add_query_arg( array(
358
  'redirect_to' => urlencode( $_REQUEST['redirect_to'] )
374
  */
375
  public function filter_user_row_actions( array $actions, WP_User $user ) {
376
 
377
+ if ( ! $link = self::maybe_switch_url( $user ) ) {
378
  return $actions;
379
  }
380
 
386
  /**
387
  * Adds a 'Switch To' link to each member's profile page and profile listings in BuddyPress.
388
  *
 
389
  */
390
  public function action_bp_button() {
391
 
392
  global $bp, $members_template;
393
 
394
  if ( !empty( $members_template ) and empty( $bp->displayed_user->id ) ) {
395
+ $user = get_userdata( $members_template->member->id );
396
  } else {
397
+ $user = get_userdata( $bp->displayed_user->id );
398
  }
399
 
400
+ if ( ! $user ) {
401
+ return;
402
+ }
403
+ if ( ! $link = self::maybe_switch_url( $user ) ) {
404
  return;
405
  }
406
 
407
  $link = add_query_arg( array(
408
+ 'redirect_to' => urlencode( bp_core_get_user_domain( $user->ID ) )
409
  ), $link );
410
 
411
  # Workaround for https://buddypress.trac.wordpress.org/ticket/4212
428
  /**
429
  * Adds a 'Switch To' link to each member's profile page in bbPress.
430
  *
 
431
  */
432
  public function action_bbpress_button() {
433
 
434
+ if ( ! $user = get_userdata( bbp_get_user_id() ) ) {
435
+ return;
436
+ }
437
+ if ( ! $link = self::maybe_switch_url( $user ) ) {
438
  return;
439
  }
440
 
441
  $link = add_query_arg( array(
442
+ 'redirect_to' => urlencode( bbp_get_user_profile_url( $user->ID ) )
443
  ), $link );
444
 
445
  ?>
451
  }
452
 
453
  /**
454
+ * Helper function. Returns the switch to or switch back URL for a given user.
455
  *
456
+ * @param WP_User $user The user to be switched to.
457
  * @return string|bool The required URL, or false if there's no old user or the user doesn't have the required capability.
458
  */
459
+ public static function maybe_switch_url( WP_User $user ) {
460
 
461
  $old_user = self::get_old_user();
462
 
463
+ if ( $old_user and ( $old_user->ID == $user->ID ) ) {
464
+ return self::switch_back_url( $old_user );
465
+ } else if ( current_user_can( 'switch_to_user', $user->ID ) ) {
466
+ return self::switch_to_url( $user );
467
  } else {
468
  return false;
469
  }
473
  /**
474
  * Helper function. Returns the nonce-secured URL needed to switch to a given user ID.
475
  *
476
+ * @param WP_User $user The user to be switched to.
477
  * @return string The required URL
478
  */
479
+ public static function switch_to_url( WP_User $user ) {
480
  return wp_nonce_url( add_query_arg( array(
481
  'action' => 'switch_to_user',
482
+ 'user_id' => $user->ID
483
+ ), wp_login_url() ), "switch_to_user_{$user->ID}" );
484
  }
485
 
486
  /**
487
  * Helper function. Returns the nonce-secured URL needed to switch back to the originating user.
488
  *
489
+ * @param WP_User $user The old user.
490
  * @return string The required URL
491
  */
492
+ public static function switch_back_url( WP_User $user ) {
493
  return wp_nonce_url( add_query_arg( array(
494
  'action' => 'switch_to_olduser'
495
+ ), wp_login_url() ), "switch_to_olduser_{$user->ID}" );
496
  }
497
 
498
  /**
499
  * Helper function. Returns the nonce-secured URL needed to switch off the current user.
500
  *
501
+ * @param WP_User $user The user to be switched off.
502
  * @return string The required URL
503
  */
504
+ public static function switch_off_url( WP_User $user ) {
505
  return wp_nonce_url( add_query_arg( array(
506
  'action' => 'switch_off'
507
+ ), wp_login_url() ), "switch_off_{$user->ID}" );
508
  }
509
 
510
  /**
525
  public static function remove_query_args( $url ) {
526
  return remove_query_arg( array(
527
  'user_switched', 'switched_off', 'switched_back',
528
+ 'message', 'update', 'updated', 'settings-updated', 'saved',
529
+ 'activated', 'activate', 'deactivate', 'enabled', 'disabled',
530
  'locked', 'skipped', 'deleted', 'trashed', 'untrashed'
531
  ), $url );
532
  }
582
  * Sets an authorisation cookie containing the originating user, or appends it if there's more than one.
583
  *
584
  * @param int $old_user_id The ID of the originating user, usually the current logged in user.
 
585
  */
586
  if ( !function_exists( 'wp_set_olduser_cookie' ) ) {
587
  function wp_set_olduser_cookie( $old_user_id ) {
597
  * Clears the cookie containing the originating user, or pops the latest item off the end if there's more than one.
598
  *
599
  * @param bool $clear_all Whether to clear the cookie or just pop the last user information off the end.
 
600
  */
601
  if ( !function_exists( 'wp_clear_olduser_cookie' ) ) {
602
  function wp_clear_olduser_cookie( $clear_all = true ) {