Title: ABCode View As Role Switcher
Author: Ash Brentnall | ABCode
Published: <strong>অক্টোবৰ 18, 2024</strong>
Last modified: আগষ্ট 4, 2026

---

প্লাগিনৰ সন্ধান কৰক

![](https://ps.w.org/simple-admin-role-switcher/assets/banner-772x250.png?rev=3635217)

![](https://ps.w.org/simple-admin-role-switcher/assets/icon-256x256.png?rev=3635217)

# ABCode View As Role Switcher

 [Ash Brentnall | ABCode](https://profiles.wordpress.org/ashbrentnall/)-ৰ দ্বাৰা

[ডাউনল’ড কৰক](https://downloads.wordpress.org/plugin/simple-admin-role-switcher.2.0.0.zip)

 * [বিশদ বিৱৰণ](https://as.wordpress.org/plugins/simple-admin-role-switcher/#description)
 * [পৰ্য্যালোচনা](https://as.wordpress.org/plugins/simple-admin-role-switcher/#reviews)
 *  [ইনষ্টলেশ্যন](https://as.wordpress.org/plugins/simple-admin-role-switcher/#installation)
 * [বিকাশ](https://as.wordpress.org/plugins/simple-admin-role-switcher/#developers)

 [সাহায্য](https://wordpress.org/support/plugin/simple-admin-role-switcher/)

## বৰ্ণনা

**ABCode View As Role Switcher** lets an administrator see the front end of the 
site exactly as a chosen user role sees it, without logging out and without creating
a test account for every role on the site.

Pick a role from the toolbar, and the front end reloads with that role’s capabilities.
Member-only content hides itself. Price rules, menus, shortcodes and blocks that
check who is looking behave as they would for a real customer or subscriber. Pick**
Switch back** and you are yourself again.

#### Switch to a role, not to a user

Most switching plugins log you in as a specific person. That is a different job,
and it means keeping a spare account for every role you want to check, then keeping
those accounts in step as the site changes.

This plugin switches to the _role_. Add a role today, test it in the next click.
There is no dummy account to create, no password to store, no extra user cluttering
the users list, and nothing to tidy up afterwards. It never touches anybody’s real
account.

#### Capabilities actually change

The switch is applied where WordPress decides what a visitor is allowed to see, 
so `current_user_can()` tells the truth for the length of the session. That is the
function themes, WooCommerce, membership plugins and page builders all call, which
is why the pages you test look like the pages your users get.

The view is always a subset of your own account. It can only ever take capabilities
away, never add them, so it can never be used to reach something you could not already
reach.

#### Features

 * **Switch from the toolbar:** every role on the site is one click away, on the
   front end and inside wp-admin
 * **View as a logged-out visitor:** check the guest experience without a private
   window or a second browser
 * **Real capability switching:** `current_user_can()`, `user_can()` and role checks
   all agree with the role you picked
 * **A visible switched state:** the toolbar item turns green and reads “Viewing
   as: Subscriber”, so you always know what you are looking at
 * **One-click way back:** the same toolbar item ends the session, and wp-admin 
   is never switched, so you cannot lock yourself out
 * **Automatic expiry:** a session ends by itself after 15 minutes, 1 hour or 8 
   hours, whichever you choose
 * **Nothing is saved to the database:** no user’s stored roles or capabilities 
   are ever written to
 * **Choose what appears:** tick the roles you actually test with, and leave the
   rest out of the menu
 * **Secure by design:** a signed, HttpOnly cookie tied to your login session, plus
   a compulsory nonce on every switch
 * **Free forever:** no premium tier, no feature locks, no upsells
 * **Translation ready:** fully internationalised, with five languages included

#### Who is this for?

 * **WooCommerce shops** checking what a customer, a shop manager or a guest sees
   on a product page
 * **Membership and course sites** confirming that gated content really is gated
 * **Agencies and freelancers** handing over a site and wanting proof the permissions
   are right
 * **Anybody** who has ever asked “does this menu item show up for subscribers?”

#### How it works

 1. Go to **View As** in the toolbar
 2. Choose a role, or **View as a logged-out visitor**
 3. Browse the site the way that role would
 4. Choose **Switch back to your own account** when you are done

The switch applies to front-end page loads only. wp-admin, the REST API and admin
AJAX always run as your real account, on purpose: it means there is always a way
back, whatever the role you switched to is allowed to do.

### Privacy

The plugin stores one cookie, set only when you start a view session, and only for
you. It holds the role being viewed, an expiry time and a signature, and is removed
when the session ends, when you log out, or when it expires. Nothing is sent anywhere,
no data is collected, and no third party is involved.

## স্ক্ৰীনশ্বট

[⌊The View As menu in the toolbar, listing every role you have chosen to test with⌉⌊
The View As menu in the toolbar, listing every role you have chosen to test with⌉[

The View As menu in the toolbar, listing every role you have chosen to test with

[⌊A switched session, with the toolbar showing the role being viewed and the way
back⌉⌊A switched session, with the toolbar showing the role being viewed and the
way back⌉[

A switched session, with the toolbar showing the role being viewed and the way back

[⌊Tools > View As Role, where you choose which roles appear and how long a session
lasts⌉⌊Tools > View As Role, where you choose which roles appear and how long a 
session lasts⌉[

Tools > View As Role, where you choose which roles appear and how long a session
lasts

## ইনষ্টলেশ্যন

 1. Upload the `simple-admin-role-switcher` folder to `/wp-content/plugins/`
 2. Activate the plugin through the **Plugins** menu in WordPress
 3. Use **View As** in the toolbar. Settings, if you want them, are at **Tools > View
    As Role**

## সঘনাই উত্থাপিত প্ৰশ্ন

### How do I preview my site as a customer?

Hover **View As** in the toolbar and choose **View as Customer**. The page reloads
with a customer’s capabilities and the toolbar turns green to show you are in a 
switched view. Choose **Switch back to your own account** to end it.

### Do I need a test account for each role?

No, and that is the point of this plugin. It switches to the role itself, so a role
added by WooCommerce or a membership plugin this morning can be tested this afternoon
with nothing to set up first.

### Does it change a user’s real role?

Never. Nothing is written to the database at any point. The switch is a filter applied
while a page is being built, held in a signed cookie that expires on its own, and
it only ever affects the person who started it.

### Does it work with WooCommerce?

Yes. Switch to Customer, Shop Manager, or a logged-out visitor and browse the shop,
a product page or the account pages. Anything that asks WordPress what the current
user is allowed to do, which is how WooCommerce and its extensions gate content,
gets the switched answer.

### Does it work with membership plugins and page builders?

Yes, for anything that gates content on capabilities or roles, which is nearly all
of them. Content restricted to a specific _user_, or to somebody’s purchase history,
is tied to an account rather than a role, so that will still resolve against your
own account.

### Can I view the site as a logged-out visitor?

Yes. **View as a logged-out visitor** treats the request as though nobody is signed
in, so you see exactly what a first-time visitor sees. The toolbar stays on screen
so you can get back.

### How do I switch back?

Click the green **Viewing as** item in the toolbar, or pick **Switch back to your
own account** from it. If the toolbar is hidden by your theme, go to **Tools > View
As Role** in wp-admin and press **End the session now**. wp-admin is never switched,
so that page always works.

### Can I get stuck in a role?

No. There are three separate ways out: the toolbar, the button on the settings screen,
and the session’s own expiry. Logging out ends it too.

### Does the switch affect what other visitors see?

No. It applies to your browser only, for the length of the session. Nobody else’s
experience of the site changes.

### Does it work in wp-admin?

The switcher is _available_ in wp-admin, and choosing a role from there opens the
front end in a new tab. The switch itself is deliberately not applied to admin screens,
because an administrator browsing wp-admin with a subscriber’s capabilities would
simply be locked out of it.

### Does it work with a page cache?

Not reliably, no, and neither does any plugin of this kind. A full-page cache can
serve a stored copy of the page before WordPress has a chance to decide who you 
are. Most caching plugins skip the cache for logged-in users, which is usually enough;
if a switched page looks wrong, clear the cache and reload.

### Who can switch roles?

Only users who can manage options, which in practice means administrators. Every
switch is checked twice: once for the capability, and once for a valid nonce. The
cookie holding the session is signed with a server-side key and tied to your login
session, so it cannot be forged or handed to somebody else.

### Does it work on multisite?

Yes, per site. Any administrator of a site can switch roles on that site, and the
switch is confined to it. Network administrators are covered too: super admin status
is set aside for the length of the view, otherwise the switch would have no effect
at all.

### Can I hide roles I never test with?

Yes. **Tools > View As Role** lists every role on the site, and only the ones you
tick appear in the toolbar. Sites with a dozen roles from an eCommerce or LMS plugin
are much easier to work with once the list is short.

## পৰ্য্যালোচনা

এই প্লাগিনৰ বাবে কোনো পৰ্য্যালোচনা নাই।

## অৱদানকাৰী আৰু বিকাশকাৰীসকল

“ABCode View As Role Switcher” হৈছে মুক্ত উৎসৰ ছফ্টৱেৰ। এইসকল লোকে এই প্লাগিনত অৱদান
আগবঢ়াইছে।

অৱদানকাৰীসকল

 *   [ Ash Brentnall | ABCode ](https://profiles.wordpress.org/ashbrentnall/)
 *   [ ABCode ](https://profiles.wordpress.org/abcodeuk/)

[আপোনাৰ ভাষাত “ABCode View As Role Switcher” অনুবাদ কৰক।](https://translate.wordpress.org/projects/wp-plugins/simple-admin-role-switcher)

### বিকাশৰ প্ৰতি আগ্ৰহী?

[ক’ড ব্ৰাউজ কৰক](https://plugins.trac.wordpress.org/browser/simple-admin-role-switcher/),
[SVN ৰিপজিটৰী](https://plugins.svn.wordpress.org/simple-admin-role-switcher/) চাওক
নাইবা [RSS](https://plugins.trac.wordpress.org/log/simple-admin-role-switcher/?limit=100&mode=stop_on_copy&format=rss)-
দ্বাৰা [বিকাশৰ পঞ্জী](https://plugins.trac.wordpress.org/log/simple-admin-role-switcher/)
ছাবস্ক্ৰাইব কৰক।

## সলনি-পঞ্জী

#### 2.0.0

A full rewrite. Role switching now works.

 * **Fixed the central bug: switching roles had no effect on capabilities.** Version
   1.0 assigned to a property on the user object that WordPress never recalculates,
   so `current_user_can()` carried on answering as an administrator. The site behaved
   exactly as it always had while the toolbar claimed otherwise. Anything tested
   with 1.0 was, in effect, tested as an administrator and is worth checking again.
 * Added: capability filtering, applied where WordPress resolves what the current
   user may do, so themes, WooCommerce, membership plugins and page builders all
   see the switched role
 * Added: ownership-aware handling of meta capabilities, so content you wrote yourself
   is treated as somebody else’s while you are viewing as another role
 * Added: the switched view is always a subset of your own capabilities and can 
   never grant one you do not have
 * Added: a settings screen at **Tools > View As Role** for choosing which roles
   appear in the toolbar and how long a session lasts
 * Added: automatic expiry, at 15 minutes, 1 hour or 8 hours
 * Added: the switched state is now obvious in the toolbar, with a one-click way
   back from every page
 * Added: multisite support, including network administrators
 * Added: full internationalisation, with German, Spanish, French, Italian and Brazilian
   Portuguese translations
 * Fixed: the nonce check could be skipped entirely by leaving the nonce out of 
   the request, and the guest and reset links never carried one. Every switch now
   verifies a nonce, with no exceptions
 * Fixed: the cookie was trusted without re-checking that the person presenting 
   it was an administrator
 * Fixed: the cookie is now signed, HttpOnly, Secure over HTTPS, SameSite Lax, and
   scoped to the site’s own cookie path
 * Fixed: the switch is now in place at the start of the request rather than at 
   template load, so plugins that resolve capabilities early see it
 * Fixed: redirects now use `wp_safe_redirect()`
 * Fixed: role comparisons now use strict matching
 * Changed: renamed to ABCode View As Role Switcher. The plugin slug, your settings
   and your update path are unchanged
 * Changed: the switch applies to front-end page loads only. wp-admin always runs
   as your real account, which is what guarantees you can never be locked out
 * Removed: `load_plugin_textdomain()`, which WordPress has not needed since 4.6

#### 1.0

 * Initial release

## মেটা

 *  **2.0.0** সংস্কৰণ
 *  **3 দিন আগত** শেষবাৰ আপডে’ট হৈছিল
 *  সক্ৰিয় ইনষ্টলেশ্যন **10টাতকৈ কম**
 *  WordPress-ৰ সংস্কৰণ ** 5.0 বা তাতকৈ ওপৰৰ **
 *  ইমানলৈকে পৰীক্ষা কৰা হৈছে **7.0.3**
 *  PHP-ৰ সংস্কৰণ ** 7.4 বা তাতকৈ ওপৰৰ **
 *  ভাষা
 * [English (US)](https://wordpress.org/plugins/simple-admin-role-switcher/)
 * [role switcher](https://as.wordpress.org/plugins/tags/role-switcher/)[user roles](https://as.wordpress.org/plugins/tags/user-roles/)
 *  টেগবোৰ
 *  [উচ্চখাপৰ ভিউ](https://as.wordpress.org/plugins/simple-admin-role-switcher/advanced/)

## ৰে’টিংবোৰ

এতিয়ালৈ কোনো পৰ্য্যালোচনা দাখিল কৰা হোৱা নাই।

[Your review](https://wordpress.org/support/plugin/simple-admin-role-switcher/reviews/#new-post)

[See all reviews](https://wordpress.org/support/plugin/simple-admin-role-switcher/reviews/)

## অৱদানকাৰীসকল

 *   [ Ash Brentnall | ABCode ](https://profiles.wordpress.org/ashbrentnall/)
 *   [ ABCode ](https://profiles.wordpress.org/abcodeuk/)

## সাহায্য

কিবা ক’বলগীয়া আছে? সহায় লাগে?

 [সাহায্যৰ ফ’ৰাম চাওক](https://wordpress.org/support/plugin/simple-admin-role-switcher/)

## দান কৰক

আপুনি এই প্লাগিনৰ উন্নতিৰ প্ৰতি সাহায্য আগবঢ়াব বিচাৰেনে?

 [ এই প্লাগিনক অনুদান দিয়ক ](https://abcode.co.uk/)