Skip to content

Commit

Permalink
Address some newly identified coding standards issues.
Browse files Browse the repository at this point in the history
  • Loading branch information
johnbillion committed Oct 10, 2023
1 parent 6d7f96d commit acbed33
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions user-switching.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
* Main singleton class for the User Switching plugin.
*/
class user_switching {

/**
* The name used to identify the application during a WordPress redirect.
*
Expand Down Expand Up @@ -1195,7 +1194,6 @@ public static function get_instance() {
* Private class constructor. Use `get_instance()` to get the instance.
*/
private function __construct() {}

}

if ( ! function_exists( 'user_switching_set_olduser_cookie' ) ) {
Expand Down Expand Up @@ -1404,16 +1402,15 @@ function switch_to_user( $user_id, $remember = false, $set_old_user = true ) {
* Attaches the original user ID and session token to the new session when a user switches to another user.
*
* @param array<string, mixed> $session Array of extra data.
* @param int $user_id User ID.
* @return array<string, mixed> Array of extra data.
*/
$session_filter = function( array $session, $user_id ) use ( $old_user_id, $old_token ) {
$session_filter = function ( array $session ) use ( $old_user_id, $old_token ) {
$session['switched_from_id'] = $old_user_id;
$session['switched_from_session'] = $old_token;
return $session;
};

add_filter( 'attach_session_information', $session_filter, 99, 2 );
add_filter( 'attach_session_information', $session_filter, 99 );

wp_clear_auth_cookie();
wp_set_auth_cookie( $user_id, $remember, '', $new_token );
Expand Down

0 comments on commit acbed33

Please sign in to comment.