With the release of WP User Manager 2.4 and the Custom Fields 2.2 addon, came the release of the newest field type, the Repeater Field. The Repeater Field allows you to collect complex data in your registration form from field groups and sub-fields.
Essentially, if you want to collect a number of a set of information from your users on registration, the repeater field is the way to do it.
For example, you need information on financial incentives to give you your users based on the number of dependents that they have. Instead of asking how many dependents they have, and having them list the names and other information separately, you can make use of the repeater field and the sub-fields to collect that information. Your user can simply add the number of rows, or field groups, applicable to them.
How to Add the Repeater Field
The repeater field is a new addition to the custom fields addon for WP User Manager 2.4. You can locate it under the other advanced custom fields for your registration form.
NOTE: Both WP User Manager and the Custom Fields 2.2 addon need to be installed and activated to see these options.
- Navigate to USERS > CUSTOM FIELDS
- From here, you can either choose to “Add New Field Group” or click “Customize Fields” to customize your existing Field Group.
- From here, click on the “Add new custom field” button.
- Click on the “Advanced Fields” Tab
- Add a name for your Repeater Field
- Click on “Repeater”
- Click “Create custom field”
After the field has been created, you will immediately be shown the options to customize your repeater field.
NOTE: You can make the changes now from here, or you can close it for now and come back to edit it later.
Adding Sub-fields
Once you’ve created your new custom repeater field, you would have to add sub-fields before you’ll be ready to add them to your registration form.
Adding sub-fields is the same process as adding any other fields to your form, you simply have to add the necessary fields that you want to be repeatedly asked once the user decides to add a new row for their entries.
Sub-field Settings
Similar to adding normal custom fields to your field group, the sub-field settings on the repeater field will have settings and will require you to put in all the necessary information.
Be sure to only add the information you want to be repeatedly asked your users upon registration. Take note that if you will be asking for names and email addresses, the entries on the sub-fields will not be considered as registered users. They will act just like any normal entries on the registration form.
General
Under the “General” tab, you will find the following settings:
- Field title – the name of the repeater field that will be displayed on your registration form.
- Field description – this optional field is the text that will appear as a description within the forms
- Unique meta key – this field is important to specify or remember since this will be the tag of the data or information about your users that will be stored on your databaseNOTE: The key must be unique for each field and written in lowercase with an underscore (_) separating the word, e.g., country_list or job_title. Errors might result in adding the information on the database if this field is not properly formatted.
- Button label – this will be the title of the button that will appear on the registration form whenever a user decides to add another row of the repeater field
It’s good practice to pay attention to these fields since these will be the basic settings needed for the field.
Validation
The “Validation” tab provides settings for requiring user inputs on the registration form.
- Set as required – enable this option to ensure that the field is filled out before the form can be submitted.
- Minimum rows – this field will set the minimum required number of rows, or repeats, for this field, leaving it blank defaults it to Not Applicable
- Maximum rows – this field will set the maximum number of rows, or repeats for this field. Leaving it blank defaults it to Not Applicable.
Privacy
The “Privacy” tab provides the settings to control the visibility of the information on the user’s profile section.
- Profile visibility – this setting sets the visibility of this field on the user’s profile pages.
Permissions
The “Permissions” tab provides the settings to control what the users can update or edit once the registration form has been submitted.
- Profile editing – this setting sets who can see and edit this field after submission. Setting this to “Hidden” will not allow editing on the front-end profile page.
- Set as read-only – enable this option to prevent users from editing this field on their profile page. If the profile editing is set to publicly editable, the field will still be visible within the account page but will not be customizable
Adding to the Registration Forms
Once you’ve set and added the Repeater Field it’s time to add this custom field to the registration form. Here’s how you can do that:
- Navigate to USERS > REGISTRATION FORMS
- Click “Add New Form” in case you want to create a new form with this field, otherwise, click “Customize Form” to customize the existing form.
- Drag and Drop the custom field that you created under the “Available Fields” from the right column to the “Form Fields” on the left. You can rearrange the fields as you see fit.
The changes are automatically saved after you make them and will take effect immediately.
Previewing the Registration Form
Once you’ve updated the registration form and added the repeater field, since the changes are automatically updated, you can preview if this works by logging out and replicating the registration process.
To update your registration, profile, and account pages, add shortcodes including parameters, read more on this documentation page.
On the Profile Page
Depending on the setting that you set under the “Privacy” and “Permissions” tab of the custom field, the information that was submitted can be seen on the user’s profile page and displayed like the below image by default.
Editing the Repeater Field from the Profile Page
Once the user has successfully registered, and if the “Privacy” and “Permissions” settings that you set for this field, the user can easily update and edit the information from their account or profile page.
From the Profile page, click on the “Edit account” link next to the username to be directed to the Account page where the users can add more rows/entries, or update the existing information on the fields.
Get Started with the Best WordPress Membership Plugin Today
Connect, Manage and Build your Membership Site