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.

Contents:

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.

Registration flow:

  1. 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.
  2. 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.
  3. 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):

  1. WooCommerce always assigns the role "Customer" on checkout. It is not our functionality, it is a part of native WooCommerce functionality. 
  2. 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.
  3. 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.

WP-Users-Change-role.png

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 #

Profile settings #

You can make a profile form role-specific. Use the setting  "Make this profile form role-specific" on [wp-admin > Ultimate Member > Forms > Edit Form (profile)] in the box "Customize this form". This setting is a multi-select. Select all user roles allowed for this profile form or leave this setting blank.

This feature must be used if you place multiple profile forms on the profile page. Example: use the first profile form for the administrator's profile and use the second profile form for other profiles.

Image - How to make a profile form role-specific.

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.

UM-User-Roles-Edit-Role--Profile-Access.png

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 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 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.

UM-Member-Directories-Edit--General-Options--User-Roles-to-Display.png

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.