Simple role toggler lets users switch off some of the roles they hold while they browse, and switch them back on when they need them.
A site editor who is also a content administrator can look at the site as a regular user: without the administration toolbar, the contextual links or the permissions of the switched-off roles. When they need to edit, one click brings the roles back.
The user's roles are never changed. They are only switched off for the user's requests, so an administrator never locks themselves out.
Features
- A form with one checkbox per role, a button to bring all roles back and, for users who may switch every role off, an anonymous view.
- Two blocks to place the form: the full form, or an icon that opens it in a dialog. A Roles tab in the toolbar too, when the Toolbar module is on.
- Two permissions: Toggle own unrestricted roles and Toggle own restricted roles. A role marked Restricted can only be switched off by users with the second one.
- The choice lasts for the session and comes back at the next login, on any device. Logging out on purpose switches every role back on, unless the setting says otherwise.
- Optional roles in one browser tab: keep all your roles in one tab and look at the site as an editor in another.
- Switching roles only ever takes permissions away: a user never gets a role they do not hold. Access policies of other modules still apply.
Requirements
Drupal 11.2 or later, or Drupal 12. No other module.
Getting started
- Grant Toggle own unrestricted roles, through a role of its own such as "Toggler".
- Place the Simple role toggler block, or its icon variant, in the front-end theme.
- Review the settings at Configuration > People > Simple role toggler.
The full documentation is in the docs/ folder of the module, and published at project.pages.drupalcode.org/simple_role_toggler.
Credits
The module grew from Role toggle and its 8.x-2.x rewrite by geek-merlin, with anruether.
Ask your assistant about Simple role toggler
Check compatibility with your Drupal and PHP version, maintenance and security coverage, from current release data. How it works
Depends on
Dependencies of the latest stable release
No dependencies recorded for this project.
Required by
Tracked projects that depend on this one
No tracked projects depend on this one yet.