Forcing the user to choose one role after login, and led to other roles
does not work. User can switch role anytime just visit select_role/landing.
This module is useful if your site have differences significantly related
layout and menu item on each role.
For example, you have a website of journal system, which has roles: author,
editor, and reviewer. Sometimes there is one user who has three roles at once.
If that user login, you want that user has to choose one role only. As soon as
the user login, the user must choose one role. After one role is selected,
then other roles will be removed for a while. So, if he/she selects a role as
an author, then the permission and access at the time he role as a reviewer
will not work.
This module uses hook_boot to remove unused roles from $GLOBALS['user']->roles.
Install as you would normally install a contributed drupal module. See:
for further information.
Steps to test this module
- Login as user#1, then make roles: author, editor, reviewer, lecturer.
- Visit: admin/config/people/select_role, then check for author, editor, and
reviewer, then save.
- Create one user called desi. give her role of author and reviewer. Save.
- Give access to the role author which can create article.
- Give access to the role reviewer which can create basic page.
- Logout from user#1, and login as desi. Now you will see the effect of this
module. Visit node/add
Visit admin/config/people/select_role, there two fields
- Global Select Role
User who have the role(s), need to select single role only. This
configuration effected for all user.
- Excluded Pages
Indicates which pages will be ignored (no select role checks). Example: Your
custom logout page. By default, path js/* is used by admin_menu module to
Visit user/[user:uid]/edit, there are a new field "Select Role", if there are
special people who choose different roles than others, (example: your boss
doesn't need to select role: author, editor, and reviewer, he only need
select role: editor, and lecturer) you can set here.
- Q: Are user who has chosen the role can switch to other role, without logout?
A: Yes, just visit select_role/landing
- Maintenance status: Actively maintained
- Development status: Under active development
- Module categories: User Access & Authentication
- Reported installs: 18 sites currently report using this module. View usage statistics.
- Downloads: 618
- Last modified: June 5, 2015
- Stable releases are covered by the security advisory policy.
Look for the shield icon below.