The user field is a new field type available in WP User Manager’s Custom Fields addon. This field type allows your users to select other users of the site when registering for a new one.
The User Field type helps to define the relationships between users in your site.
How To Create a User Field Type
Adding User Field is just as simple as adding any other custom fields in your registration form.
- Navigate to Users > Custom Fields
- You can click the ‘Add New Field Group’ to add another field group or click ‘Customize Fields’ if you want to customize an existing field group.
- Click ‘Add new custom field’ on the upper left side of your field editor page.
- Go to ‘Advanced Fields’ then type in your desired ‘Field name’.
- Select the ‘User’ field, then click ‘Create custom field’ to open the settings and options for the User Field type.
In the ‘General’ options you can define the basic settings of your user field.
- You can edit the ‘Field title’ of your user field.
- You have the option to add ‘Field description’ if needed.
- It also shows an auto-generated ‘Unique meta key’ that will be used to store information about your users in your website database.
- You can also put a ‘Placeholder’ for your User Field if needed.
- You can also choose to ‘Filter by role’ your User Field and select different roles from Administrator, Editor, Customer, and more.
- You can ‘Allow multiple selection’ and‘Show users with hidden profiles’.
- You can also put a ‘Type label’ for your users.
You can make your User Field a mandatory field to fill before the form can be processed by enabling the ‘Set as required’ option in the ‘Validation’ settings.
You can choose to make your User Field ‘Publicly visible’ or ‘Hidden’ on user’s profiles.
Under ‘Permissions’ you can set who can edit the User Field. YOu can choose to make it ‘Publicly editable’ or ‘Hidden’ within the front-end of your account page.
You can also prevent users from editing the User Field by enabling the ‘Set as read only’ option.
For conditional logic, please see our detailed documentation on the conditional field type. <insert interlinks>
Once you’re done with the settings, click “Save changes”to create the User Field.
Adding User Field to The Registration Form
Now that you have created a User Field the next step is to add the User Field to the Registration Form.
- Navigate to Users > Registration Forms
- You can create a new Registration Form by clicking the ‘Add New Form’ or you can edit an existing Registration Form by clicking the ‘Customize Form’.
- Drag and drop the User Field you created from the list of ‘Available Fields’ to the list of ‘Form Fields’.
- The changes you made will be saved automatically.
Once you’ve added the User Field to the registration form you can now preview by logging out and going to the Registration Form on your site.
The Profile and Account Page
The appearance of the User Field depends on the ‘Privacy’ and ‘ Permissions’ settings that you set for the User Field.
Editing the User Field from the Profile Page
Once the user has successfully registered, the user can now view the profile page.
If the ‘Privacy’ and ‘Permissions’ settings that you set for the user field allows the user to update and edit the information from their account or profile page, the user can click the ‘Edit account’ beside the Username to go to the Account page and edit the fields.