Viewing 1 replies (of 1 total)
  • Plugin Author John Blackbourn

    (@johnbillion)

    WordPress Core Developer

    Yep! There is a function called current_user_switched() in the plugin. It returns false if the user isn’t logged in or they didn’t switch in. It returns their old WP_User object (which evaluates to true) if the user switched into the current user account.

    Example:

    $old = current_user_switched();
    
    if ( $old ) {
      printf( 'Your old username is %s', $old->user_login );
    } else {
      echo 'You did not switch in to your account';
    }
Viewing 1 replies (of 1 total)
  • The topic ‘Check user switched?’ is closed to new replies.