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.
- Assign user role
- Configure role fields
- Limit profile access by role
- Make profile role-specific
- Members Directory role settings
- Add role-specific content
Assign user role #
Default role #
Each user has one or several roles. WordPress assigns a default user role when creating a new user. Use the setting "New User Default Role" on the page [wp-admin > Settings > General] to select the default user role. You may override this setting by registration form settings, it may be useful if you have several registration forms.
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 level (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 #
You can list all existing user roles on the page [wp-admin > Ultimate Member > User Roles]. You can create a new user role by clicking the button "Add New". You can overview and change user role settings by clicking the user role name. Use settings "Can view other member profiles?" and "Can view these user roles only" to manage profiles visibility for the user role.
Read the article User Roles Settings for details.
Image - Limit profile access by roles.
Role Priority #
WordPress users may have several roles. Ultimate Member uses settings from the role with a 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 each user role. 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".
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 an unique shortcode that you can paste to the page to display it. 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 specific user role. 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.