Multiple User Roles Module: Advanced User Role Management
In WordPress, each user can be assigned just one role at a time, limiting the flexibility of permissions management. However, in specific cases, such as with e-commerce or LMS (Learning Management System) plugins, the ability to assign multiple roles to a user becomes essential. That's why we've developed the Multiple User Roles in WPMasterToolKit.
This module aims to simplify the assignment and management of multiple user roles directly from the WordPress administration interface, without having to install a third-party plugin or write code.
Which plugins can the Multiple User Roles module replace?
The module Multiple User Roles can replace several popular WordPress plugins dedicated to advanced user role management, such as :
- User Role Editor used to modify roles and their permissions.
- Members WPMasterToolKit: which offers similar functionality but with a more complex interface. With WPMasterToolKit, you benefit from an integrated, lightweight, high-performance solution.
The module's main functions
- Adding multiple roles to a user
With this module, you can assign multiple roles to a user when creating an account or modifying a profile. For example, a user can be both "Author" and "Customer" without conflict. - Intuitive interface
The module adds a checkbox in the "User profile" section to select the roles to be assigned. This makes the process simple and accessible even for non-technical administrators. - Advanced permissions management
This system supports custom roles defined by other plugins such as WooCommerce ("Customer" or "Shop Manager" roles) or LMS platforms ("Instructor", "Student" roles, etc.). - Compatible with editable roles
The module ensures that only roles that can be modified by the current administrator are available, by using the native functionget_editable_roles()
from WordPress.
How do I use the "Multiple User Roles" module?
- Module activation
Once the module has been activated via the WPMasterToolKit interface, you can start using it straight away. - Assigning roles to an existing user
- Go to the edit user profile page in WordPress.
- A new "Roles" section appears, displaying a list of available roles.
- Select or deselect the roles you wish to assign to the user.
- Save changes.
- Assigning roles to a new user
- When creating a new user, the same interface will be available for assigning multiple roles, even before saving the user.
- Deleting and updating roles
- Deselected roles will be automatically removed from the user, and newly selected roles will be added.
The technical choices behind the module
- Using native WordPress actions
The module uses several native WordPress hooks to integrate its functionality, including :show_user_profile
andedit_user_profile
to display the roles section of the user interface.personal_options_update
andedit_user_profile_update
to save changes.
- Secure validation with nonces
To protect data against CSRF attacks, the module uses a nonce WordPress in each form. - Conditional registration of scripts and styles
Module-specific scripts and styles are only loaded on the relevant administration pages (for example,user-edit.php
anduser-new.php
), optimizing performance. - Role management with native functions
Roles are assigned and deleted using native WordPress functionsadd_role
andremove_role
for maximum compatibility with third-party plug-ins. - User data filtering
Prior to any modification, the module cleans and validates incoming data using functions such aswpmastertoolkit_clean
to guarantee the integrity of assigned roles.
Conclusion
The module Multiple User Roles is an elegant, high-performance solution for WordPress administrators looking for advanced user role management. Replacing often complex or cumbersome third-party plugins, this module integrated into WPMasterToolKit is part of a minimalist, high-performance approach focused on real user needs.
Whether you manage an online store, an educational site or a community, this module simplifies your daily tasks when it comes to managing roles and permissions. Take advantage of this feature today by simply activating the module in your WPMasterToolKit dashboard!