How to use User Roles
WordPress uses "user roles" to manage such things as users access, privacy, privileges, etc. Ultimate Member extends this functionality to limit profile access.
Please read the article User Roles Settings first to get to know about role settings.
- How to Add, Edit or Remove user role
- Assign user role
- Configure role fields
- Limit profile access by role
- Make profile role-specific
- Members Directory role settings
- Add role-specific content
How to Add, Edit or Remove user role #
Click the Add New button on the top of the page [Ultimate Member > User Roles] to add a new user role. You'll see a form Add New Role. Configure role settings, then click Create Role.
Click the Edit link under the user role title to edit it. You'll see a form Edit Role. Change role settings you need, then click Update Role.
Select the role and use the bulk action Delete to remove user roles created via Ultimate member. This bulk action doesn’t remove user roles created via third-party plugins.
Image - Add or edit user role.
Image - Delete UM Custom Role.
Assign user role #
A role for a new user #
Each user has one or several roles. WordPress assigns a role when creating a user. There are several settings that may influence the user role assigned to a new user. Part of these settings work in the registration form only, and part of them works in the checkout form only.
- The setting "New User Default Role" on the page [wp-admin > Settings > General] is a native WordPress setting for new users. This setting is used if there are no other settings.
- The setting "Registration Default Role" on the page [wp-admin > Ultimate Member > Settings > Appearance > Registration Form] is a common setting for all UM registration forms. It has a higher priority than the setting "New User Default Role" but works only in UM registration forms.
- The setting "Assign role to form" on the page [wp-admin > Ultimate Member > Forms > Edit Form > Customize this form] is a setting for a certain registration form. It has higher priority than settings "New User Default Role" and "Registration Default Role" but works only in a certain UM registration form.
Note: The site can have multiple registration forms.
Checkout flow (for WooCommerce only):
- WooCommerce always assigns the role "Customer" on checkout. It is not our functionality, it is a part of native WooCommerce functionality.
- The setting "Assign this role to users when an order is completed/processing" on the page [wp-admin > Ultimate Member > Settings > Extensions > WooCommerce] is a setting for the checkout form. It may be used to assign an additional user role on checkout. Details
Note: Users in WordPress can have multiple roles.
- The setting "When this product is bought move user to this role" on the page [wp-admin > Products > All Products > Edit Product] is a setting for the checkout form. It has a higher priority than the setting "Assign this role to users when an order is completed/processing" but works only for a certain product. Details
Change users role manually #
The Administrator can use the bulk action "Change role to..." on the page [wp-admin > Users > All Users] to change the user role manually.
Image - How to set the user role manually.
Change user role on purchase #
Our extension "Ultimate Member - WooCommerce" can change or add a user role automatically when the user purchases a product or subscription.
Read the article WooCommerce Setup to get know how to configure this extension.
Configure role fields #
You can use field types "Roles (Dropdown)" and "Roles (Radio)" to set the user role in the registration form or change it in the profile form. But not all roles are available. Role fields may contain user roles created by Ultimate Member and predefined role Subscriber. User roles created by third-party plugins are excluded to avoid conflicts. Predefined roles with high access levels (such as Administrator or Editor) are excluded to avoid security vulnerability.
You have to create a role using the button "Add New" on the page [wp-admin > Ultimate Member > User Roles], then add this role to the list of "Edit Choices" in the field settings.
Image - Configure role field choices.
Limit profile access by role #
User role settings #
Use user role settings "Can view other member profiles?" and "Can view these user roles only" on wp-admin > Ultimate Member > User Roles > Edit Role to manage profiles visibility. Turn on the setting "Can view other member profiles?" to allow members with this user role to view other members profiles. Leave the setting "Can view these user roles only" blank to allow members with this user role to view any profiles.
Image - Limit profile access by roles.
Role Priority #
WordPress users may have several roles. Ultimate Member uses settings from the role with the highest priority. Read the article How to set Role Priority for user roles for details.
Image - Role Priority.
Make profile role-specific #
You can customize profiles for user roles. Just create several role-specific profile forms with different sets of fields and settings and add them to the User page. The plugin will display profile form depending on the profile owner user role and profile form setting "Make this profile form role-specific".
Go to wp-admin > Ultimate Member > Forms > Edit Form and use the setting "Make this profile form role-specific" in the box "Customize this form" to make a profile role-specific. This setting is a multi-select. Select all user roles whose profiles can use this profile form or leave the setting blank to use this profile form for all users.
Note: This feature must be used if you place multiple profile forms on the User page.
Example: Use the first profile form for the subscriber's profile and use the second profile form for other profiles.
Image - Make profile form role-specific for a single role.
Image - Make profile form role-specific for multiple roles.
Image - User page with two role-specific profile forms.
Members Directory role settings #
You can create several member directories with different settings. Each member directory has a unique shortcode that you can paste to the page to display. You can get the shortcode, change settings or create a new member directory on the page [wp-admin > Ultimate Member > Member Directories].
Use the setting "User Roles to Display" to select what user roles this member directory should display. Read the article Member Directories 2.1.0+ for details.
Image - Limit members' directory by roles.
Add role-specific content #
Ultimate Member allows you to show or hide content to the specific user roles. You can do this by wrapping the content with the following shortcodes:
Show content to specific roles
[um_show_content roles="member"] <!-- insert content here --> [/um_show_content]
Hide content from specific roles
[um_show_content not="member"] <!-- insert content here --> [/um_show_content]
You can add multiple target roles, just use ',' e.g. [um_show_content roles="member,candidates,pets"]
Read the article Restrict content on a page/post to specific users community role for details.