Title: Admin Bar User Switching
Author: Saad Iqbal
Published: <strong>2014 年 11 月 27 日</strong>
Last modified: 2022 年 5 月 24 日

---

搜尋外掛

![](https://ps.w.org/admin-bar-user-switching/assets/banner-772x250.png?rev=1419846)

這個外掛**並未在最新的 3 個 WordPress 主要版本上進行測試**。開發者可能不再對這個
外掛進行維護或提供技術支援，並可能會與更新版本的 WordPress 產生使用上的相容性問題。

![](https://ps.w.org/admin-bar-user-switching/assets/icon-128x128.png?rev=1419846)

# Admin Bar User Switching

 由 [Saad Iqbal](https://profiles.wordpress.org/saadiqbal/) 開發

[下載](https://downloads.wordpress.org/plugin/admin-bar-user-switching.1.4.zip)

 * [詳細資料](https://tw.wordpress.org/plugins/admin-bar-user-switching/#description)
 * [使用者評論](https://tw.wordpress.org/plugins/admin-bar-user-switching/#reviews)
 *  [安裝方式](https://tw.wordpress.org/plugins/admin-bar-user-switching/#installation)
 * [開發資訊](https://tw.wordpress.org/plugins/admin-bar-user-switching/#developers)

 [技術支援](https://wordpress.org/support/plugin/admin-bar-user-switching/)

## 外掛說明

This plugin was originally developed by [Mark Wilkinson](https://markwilkinson.me/).

An admin bar “Switch to User” option is provided which on hover provides a search
box where you can query a user to switch to. The results are links to switch to 
that user. This plugin is great for when you are building sites for clients and 
it is beneficial to see the site as your logged in client see’s it.

And there is an optional mode where you can use a custom keyboard combination, say‘
su’, and it activates the form where you search for users, and then you can use 
keyboard arrows to navigate the list of results, and the return key to switch to
the selected user. The same combo can be used to focus the ‘Switch Off’ link, following
a return to simulate a click.

To activate this feature and set the custom keyboard combination, aka magic word,
you need to use the `abus_ajax_args` and add a ‘magicWord’ variable.

Note that keyboard navigation is not dependant on the custom keyboard combination,
and can be used out of the box.

## 螢幕擷圖

 * [[
 * A Switch to user item is added to the WordPress admin bar to allow you to search
   for a user to switch to.

## 安裝方式

To install the plugin:

 1. Upload to the `/wp-content/plugins/` directory
 2. Activate the plugin through the ‘Plugins’ menu in WordPress

## 常見問題集

### How do I switch to a user?

As with the User Switching plugin you can still use the “Switch To” link on the 
users overview page – nothing changes there. However the point of this plugin is
that it gives you a Switch to User link in the WordPress admin bar. This reveals
a search box where you can search for a users username. The results of this search
are clickable to “Switch To” that user.

And there is an optional mode where you can use a custom keyboard combination, say‘
su’, and it activates the form where you search for users, and then you can use 
keyboard arrows to navigate the list of results, and the return key to switch to
the selected user. The same combo can be used to focus the ‘Switch Off’ link, following
a return to simulate a click.

### What can be entered into the username search box?

You can enter a user ID, part of / exact username, URL, email, or display name, 
WordPress automatically chooses the best fields to match to based on your input.
[See here for more information on wildcard searches](https://codex.wordpress.org/Class_Reference/WP_User_Query#Search_Parameters).
Clicking submit with nothing in the search box will search all users except the 
current logged in user.

### Has the plugin any filters or actions for developers?

It does indeed, although not too many! The following filters can be used.

 * abus_switch_to_text – allows developers to change the text that is displayed 
   in the admin menu which, when on hover shows the search box
 * abus_form_output – this filter can be used to change the markup of the form which
   is used in the plugin for user searching
 * abus_switch_back_text – this filter is used to change the text shown to switch
   back to the original logged in user
 * abus_switch_to_url – this filter is used to alter the redirect url for different
   users as the filter is passed to switch to user user object
 * abus_ajax_args – this is used to activate the magic word combo as described in
   plugin description, ‘magicWord’ variable can be added to the array to activate
   the feature

## 使用者評論

![](https://secure.gravatar.com/avatar/6cfc8c01f1ea3a75ec6f7dba8f2a014ef4cca4fd63a50fb3c8772e492e472ecc?
s=60&d=retro&r=g)

### 󠀁[Switching Back Easy, Switching To Harder than need be](https://wordpress.org/support/topic/switching-back-easy-switching-to-harder-than-need-be/)󠁿

 [Dennis Bareis](https://profiles.wordpress.org/dbareis/) 2024 年 6 月 2 日

It is easy to switch back from a switched to account, not so easy to switch away
as a user list is not displayed, you have to search first. Ideally I’d have an option
to choose the accounts and have a button for each.

![](https://secure.gravatar.com/avatar/1357eeb7876812255641bdbbc72148618c45bce3a73af9e2d405e35f6eda45f5?
s=60&d=retro&r=g)

### 󠀁[Good job!](https://wordpress.org/support/topic/good-job-1608/)󠁿

 [neon67](https://profiles.wordpress.org/neon67/) 2022 年 6 月 19 日

10nx very so much

![](https://secure.gravatar.com/avatar/e39bab2a090afcc4ffc6888823566c5357edc80437d6c729cf7d86e79eb1bb39?
s=60&d=retro&r=g)

### 󠀁[Good Support](https://wordpress.org/support/topic/good-support-496/)󠁿

 [SimpleRick](https://profiles.wordpress.org/keramikoch/) 2021 年 12 月 17 日

Fast fixing of errors 🙂 Plug-In works like it should

![](https://secure.gravatar.com/avatar/8a03ff342c90e8dda600695d110f37d2adeed82ea12089075fa614a448e619ba?
s=60&d=retro&r=g)

### 󠀁[Идеальный плагин](https://wordpress.org/support/topic/%d0%b8%d0%b4%d0%b5%d0%b0%d0%bb%d1%8c%d0%bd%d1%8b%d0%b9-%d0%bf%d0%bb%d0%b0%d0%b3%d0%b8%d0%bd/)󠁿

 [Сергей](https://profiles.wordpress.org/erenbur/) 2020 年 10 月 2 日

Чувак! Ты сделал идеально работающую вещь! :)))

![](https://secure.gravatar.com/avatar/22dcf41213b58505959c76ae20650595fbd28c9653c683591c3c6f14d60f1aa5?
s=60&d=retro&r=g)

### 󠀁[Could be better](https://wordpress.org/support/topic/could-be-better-31/)󠁿

 [lucasbustamante](https://profiles.wordpress.org/lucasbustamante/) 2018 年 8 月
7 日 2 則留言

Suggestions: Option to show dropdown instead of text input (from personal experience,
most of the time site only have 2~3 users) Dropdown is loosing focus when trying
to click on it, it’s kinda annoying Uninstalled it right away, but could be a good
thing with some tweaks.

![](https://secure.gravatar.com/avatar/ef200ee7233d2b56bd663540b5a4770b9934b754fd1981a53f98400d62fcebef?
s=60&d=retro&r=g)

### 󠀁[Perfect!](https://wordpress.org/support/topic/perfect-3919/)󠁿

 [smart.u](https://profiles.wordpress.org/smartu-1/) 2017 年 4 月 3 日

Perfect! Thank you!

 [ 閱讀全部 12 則使用者評論 ](https://wordpress.org/support/plugin/admin-bar-user-switching/reviews/)

## 參與者及開發者

以下人員參與了開源軟體〈Admin Bar User Switching〉的開發相關工作。

參與者

 *   [ Saad Iqbal ](https://profiles.wordpress.org/saadiqbal/)
 *   [ WPExperts.io ](https://profiles.wordpress.org/wpexpertsio/)

[將〈Admin Bar User Switching〉外掛本地化為台灣繁體中文版](https://translate.wordpress.org/projects/wp-plugins/admin-bar-user-switching)

### 對開發相關資訊感興趣？

任何人均可[瀏覽程式碼](https://plugins.trac.wordpress.org/browser/admin-bar-user-switching/)、
查看 [SVN 存放庫](https://plugins.svn.wordpress.org/admin-bar-user-switching/)，
或透過 [RSS](https://plugins.trac.wordpress.org/log/admin-bar-user-switching/?limit=100&mode=stop_on_copy&format=rss)
訂閱[開發記錄](https://plugins.trac.wordpress.org/log/admin-bar-user-switching/)。

## 變更記錄

#### 1.4 – 2021-17-12

 * Fixed – Fixed Undefined Variable $port.

#### 1.3 – 2021-22-10

 * Fixed – Deprecated error.

#### 1.2 – 2020-02-11

 * Update – WordPress 5.3 compatibility
 * Tweak – Update and modernize the codebase

#### 1.1.1

 * Only enqueue js if the user is logged in
 * Do not seperately enqueue jQuery as it is already stated as a dependency

#### 1.1

 * Add keyboard navigation
 * Add magic-word feature, keyboard-only usage of the plugin
 * Focus search input on clicking the admin-bar button – thanks to [@shadyvb](https://github.com/shadyvb)
   for work on these features
 * Allow search on any user fields rather than just the login or username
 * Make the search query parameters extensible with a filter so developers can easily
   edit them
 * Escape calls to $_POST in the ajax search function

#### 1.0.6

 * Make the capability (edit_users by default) needed to be able to switch to users
   be filterable.

#### 1.0.5

 * Escape instances of add_query_arg in accordance with https://make.wordpress.org/
   plugins/2015/04/20/fixing-add_query_arg-and-remove_query_arg-usage/

#### 1.0.4

 * Correct an issues which could result in a PHP error when the plugin is active
   and the User Switching plugin is not active.
 * Add filter for the switch to redirect url named `abus_switch_to_url` – this allows
   devs to alter the redirect url for different users as the filter is passed to
   switch to user user object.

#### 1.0.3

 * Output styles on both front and backend to make the form look correct when results
   are returned.
 * Create a filter for developers to amend the styles as needed to match their theme
 * Use correct hook for enqueuing javascript file
 * Make sure the current logged in user does not appear in the search results

#### 1.0.2

 * Thanks for @johnbillion for pointing out the incorrect capabilities check for
   switch_to_user. This now checks against edit_user so users who can edit users
   will be the Switch to link.

#### 1.0.1

 * Use switch_to_user user capability instead of is_super_admin when checking whether
   to display Switch to link in admin bar.

#### 1.0

 * Make the Switch to User link reveals a user search box
 * Uses AJAX to populate the user switch to list which therefore makes the plugin
   more compatible for sites with lots of users.

#### 0.1

 * Initial release.

## 中繼資料

 *  版本 **1.4**
 *  最後更新 **4 年前**
 *  啟用安裝數 **2,000+**
 *  WordPress 版本需求 ** 3.1 或更新版本 **
 *  已測試相容的 WordPress 版本 **6.0.11**
 *  PHP 版本需求 ** 5.6 或更新版本 **
 *  語言
 * [English (US)](https://wordpress.org/plugins/admin-bar-user-switching/)
 * 標籤
 * [user switching](https://tw.wordpress.org/plugins/tags/user-switching/)[users](https://tw.wordpress.org/plugins/tags/users/)
 *  [進階檢視](https://tw.wordpress.org/plugins/admin-bar-user-switching/advanced/)

## 評分

 4.8 星，滿分為 5 星

 *  [  10 個 5 星使用者評論     ](https://wordpress.org/support/plugin/admin-bar-user-switching/reviews/?filter=5)
 *  [  2 個 4 星使用者評論     ](https://wordpress.org/support/plugin/admin-bar-user-switching/reviews/?filter=4)
 *  [  0 個 3 星使用者評論     ](https://wordpress.org/support/plugin/admin-bar-user-switching/reviews/?filter=3)
 *  [  0 個 2 星使用者評論     ](https://wordpress.org/support/plugin/admin-bar-user-switching/reviews/?filter=2)
 *  [  0 個 1 星使用者評論     ](https://wordpress.org/support/plugin/admin-bar-user-switching/reviews/?filter=1)

[Your review](https://wordpress.org/support/plugin/admin-bar-user-switching/reviews/#new-post)

[查看全部使用者評論](https://wordpress.org/support/plugin/admin-bar-user-switching/reviews/)

## 參與者

 *   [ Saad Iqbal ](https://profiles.wordpress.org/saadiqbal/)
 *   [ WPExperts.io ](https://profiles.wordpress.org/wpexpertsio/)

## 技術支援

使用者可在技術支援論壇提出意見反應或使用問題。

 [檢視技術支援論壇](https://wordpress.org/support/plugin/admin-bar-user-switching/)