How to sync the user role
This article explains how to add information about user role to the audience contacts.
Problem
There are difficulties in syncing role fields with the audience field:
- Field types "Roles (Dropdown)" and "Roles (Radio)" can work with user roles created by Ultimate Member (these roles have prefix "um_" in the role ID) and predefined role "Subscriber". Any other role will be skipped.
- Field types "Roles (Dropdown)" and "Roles (Radio)" are arrays. Syncing may not work if options in the form field don't match options in the audience field.
Solution
We added two virtual fields to make role syncing easier. These fields can be synced with a simple text field in the audience:
- Role slug - returns the role ID. Example: "super_editor"
- Role title - returns the role title. Example: "Super Editor"
We recommend you create a text field for the role in the audience and use the tool "Merge User Meta" to link this audience field with the site field "Role title".
Examples
Image 1 - Audience fields
Image 2 - The tool "Merge User Meta"