Title: Switch User
Last modified: May 24, 2019

---

# Switch User

 *  Resolved [cevans247](https://wordpress.org/support/users/cevans247/)
 * (@cevans247)
 * [7 years ago](https://wordpress.org/support/topic/switch-user/)
 * With the switch user plugin is it possible to display and link by display name
   or company name to identify the user quickly

Viewing 7 replies - 1 through 7 (of 7 total)

 *  Plugin Author [Mário Valney](https://wordpress.org/support/users/mariovalney/)
 * (@mariovalney)
 * [7 years ago](https://wordpress.org/support/topic/switch-user/#post-11570127)
 * Hey! Thanks for using our plugin.
 * As it’s a developer focused plugin, I’ll suggest a not-good-practice solution…
   change the plugin file:
 * Go to file [class-switch-user-frontend.php](https://github.com/mariovalney/switch-user/blob/5e09a64677ca0665586be967a57d012a0baa20e2/modules/frontend/class-switch-user-frontend.php#L175)
   in line 173 and 175.
 * The main intent to use user->login is that it is required to exist.
    I promise
   I’ll add a filter someday.
 * Have a nice weekend.
 *  Thread Starter [cevans247](https://wordpress.org/support/users/cevans247/)
 * (@cevans247)
 * [7 years ago](https://wordpress.org/support/topic/switch-user/#post-11570191)
 * Thank you I will take a look, have a great weekend too
 *  Thread Starter [cevans247](https://wordpress.org/support/users/cevans247/)
 * (@cevans247)
 * [7 years ago](https://wordpress.org/support/topic/switch-user/#post-11571272)
 * Hi Mario,
 * Tried to get the required result but no luck: any ideas how to get billing company
   name displayed, thank you
 *  echo ‘<li class=”current-user” data-user-id=”‘ . $user->billing_company . ‘”
   title=”‘ . __(“You are logged as this user”, SWITCH_USER_TEXTDOMAIN) . ‘”>’ .
   $user->user_login . ‘‘;
    } else { echo ‘<li class=”js-su-user” data-user-id=”‘.
   $user->billing_company . ‘” title=”‘ . __(“Click to login as this user”, SWITCH_USER_TEXTDOMAIN).‘”
   >’ . $user->user_login . ‘‘;
 *  Plugin Author [Mário Valney](https://wordpress.org/support/users/mariovalney/)
 * (@mariovalney)
 * [7 years ago](https://wordpress.org/support/topic/switch-user/#post-11573135)
 * You have the $user object, but billing_company is not a user property (a WordPress
   user field). Perhaps it’s a user meta data created by a plugin.
 * Try:
    `get_user_meta($user->ID, 'billing_company', true)`
 *  Thread Starter [cevans247](https://wordpress.org/support/users/cevans247/)
 * (@cevans247)
 * [7 years ago](https://wordpress.org/support/topic/switch-user/#post-11574053)
 * Thanks sorted it
 * foreach ( $users as $user ) {
 *  $billing_company = get_user_meta( $user->ID, ‘billing_company’, true );
 *  if ($user->ID == $current_user_id ) {
    echo ‘<li class=”current-user” data-user-
   id=”‘ . $user->ID . ‘” title=”‘ . __(“You are logged as this user”, SWITCH_USER_TEXTDOMAIN).‘”
   >’ . $billing_company . ‘‘; } else { echo ‘<li class=”js-su-user” data-user-id
   =”‘ . $user->ID . ‘” title=”‘ . __(“Click to login as this user”, SWITCH_USER_TEXTDOMAIN).‘”
   >’ . $billing_company . ‘‘; } }
 *  Thread Starter [cevans247](https://wordpress.org/support/users/cevans247/)
 * (@cevans247)
 * [7 years ago](https://wordpress.org/support/topic/switch-user/#post-11574057)
 * One other item, is it possible to add to child theme, thank you
 *  Plugin Author [Mário Valney](https://wordpress.org/support/users/mariovalney/)
 * (@mariovalney)
 * [7 years ago](https://wordpress.org/support/topic/switch-user/#post-11575734)
 * > One other item, is it possible to add to child theme, thank you
 * I never tried, but the plugin should not make difference from theme or child 
   theme. Maybe your child theme do not implement wp_footer function or it’s incompatible.

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘Switch User’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/switch-user_97dcfb.svg)
 * [Switch User](https://wordpress.org/plugins/switch-user/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/switch-user/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/switch-user/)
 * [Active Topics](https://wordpress.org/support/plugin/switch-user/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/switch-user/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/switch-user/reviews/)

 * 7 replies
 * 2 participants
 * Last reply from: [Mário Valney](https://wordpress.org/support/users/mariovalney/)
 * Last activity: [7 years ago](https://wordpress.org/support/topic/switch-user/#post-11575734)
 * Status: resolved