How to map the User Registration form fields value to external plugin field meta?

In order to make the User Registration plugin compatible with the external plugins like BuddyPress, SalesForce, etc, we have introduced a field mapping feature with the external plugin’s form fields.
Here are a few examples, providing detailed steps to map the form fields with the external plugins.

BuddyPress #

Create a custom profile field #

The Profile Details section of BuddyPress can be customized using a tool. You may get to it by heading to Users > Profile Fields in the WordPress administration section. Name (Primary), the sole field that is displayed by default, is a field that must be filled up. This information is used to identify a person on the website; it appears at the top of their profile and in activity items.

Profile fields can collect a variety of information from your users. BuddyPress offers the following field types: text box, multi-line text box, date selector, radio buttons, drop-down select box, multi-select box, and checkboxes. Let’s add a checkbox field to collect your users’ favorite musicians upon signup. First, click on the “Add New Field” button.

Add the “field title” (which serves as the registration form’s label) and the “field description” (which, if not empty, serves as explanatory text), determined that this field is not required, and entered your first musician choice.

You might need more options, so you can click the link “Add another option” to add more options until you’re satisfied.

You can also select a few other options for the profile field like visibility, required or not, and an option to enable the use of this field in the BuddyPress registration form.

Mapping the profile fields with the User Registration form field #

  • Create a new form or edit the existing one.
  • Add a checkbox field and make the options based on the Profile Fields you have made earlier on the BuddyPress with same options.
  • Go to Forms Settings > Extras
  • Enable form field mapping with external fields

Here, you can select two types of tables:

  • Usermeta Table: This is the default WordPress wp_usermenta table. Select the form fields and write the field keys(from the external plugin) on the available fields respectively.
  • External Table: If any of the external plugins create their own table, you will have to use this option. For example, in the case of BuddyPress, it creates its own table on the database.
  • Table Name: Select the required table name for the external plugin. In the case of BuddyPress, select wp_bp_xprofile_data
  • Column for User ID: Select ‘user_id’.
  • Column for Field Key: Select ‘field_id’.
  • Column for Field Value: Select ‘value’

Now, choose the User Registration ‘checkbox’ field on the left and write the field key for the checkbox field on the BuddyPress registration form. Hit ‘Update Form.

Field ID for the external plugin’s field

You can now register a user via the User Registration form and that user will have the checkbox field mapped in his/her BuddyPress Member account page.

Registering user via the User Registration form
BuddyPress profile page showing the mapped checkbox field from the User Registration plugin

Powered by BetterDocs