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
- Add role-specific content
- Make profile role-specific
- Members Directory role settings
- Limit profile access by role
- Grant access to the admin dashboard to a custom role
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 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 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 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 for 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.
- The setting "Assign this role to users when an order is completed/processing" on wp-admin > Ultimate Member > Settings > Extensions > WooCommerce 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 has a higher priority than the setting "Assign this role to users when an order is completed/processing" but works for a certain product. Details
Change users role manually #
Administrators can use the bulk action "Change role to..." on 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 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.
Add role-specific content #
Shortcode restriction #
You can show or hide special content to the specific user roles. Wrap the content with the shortcode
Example: Show content to specific roles.
[um_show_content roles="member"] <!-- insert content here --> [/um_show_content]
Example: 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.
Gutenberg Blocks restriction #
You can show or hide a Gutenberg Block to the specific user roles. Use settings in the box "Ultimate Member: Content Restriction" for the block.
Turn on the Enable the "Content Restriction" settings for the Gutenberg Blocks setting on wp-admin > Ultimate Member > Settings > Access > Content Restriction to enable this feature if disabled.
See also Restrict Gutenberg Blocks.
Example: Show a block to specific roles.
Make profile role-specific #
Note: This feature should be used if you need several different profile forms. Don't use this feature if you need a single common profile form, as is the default.
You can customize profiles for user roles. Create multiple 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".
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 user roles whose profiles should use this profile form. Plugin displays profile form for all users if this setting is blank.
See also Unique profiles for different user roles.
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. See Member Directories 2.1.0+.
Image - Limit members' directory by roles.
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 "Can view other member profiles?" setting to allow members with this user role to view other members profiles. Leave the "Can view these user roles only" setting 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.
Grant access to the admin dashboard to a custom role #
The role setting "Can access wp-admin" can be used to deny access to the admin dashboard for specific roles. Turn on this setting.
The role setting "Force hiding admin bar in frontend" can be used to hide the wp-admin bar for specific roles. It's better to turn off this setting for roles which can access wp-admin.
Image - Settings needed to access the admin dashboard.
WordPress uses capabilities to limit access to the admin dashboard. Verify that your custom admin role has these capabilities: read - required to access the site, edit_posts - required to access wp-admin.
Image - Capabilities needed to access the admin dashboard.
Users may need additional capabilities to access specific screens of the admin dashboard. See User Roles Settings.