Blog

How to add or update user profile fields using WordPress forms

Are you in search of an easy guide to add user profile fields using WordPress forms?

Look no more! We have it all covered for you. Starting from the basic questions like what is a WordPress frontend user profile, to how to add profile extra fields. Our WordPress experts have answered it all. Not only that, but we have also put together an easy guide to add user profile fields using WordPress forms. Let’s dig in and get started!

What are the Default WordPress User Profiles?

If you administer a user membership website, you must already know how barebones WordPress’ default user profiles are. Out of the box, you get a few basic WordPress profile fields that a user can only update by visiting the WordPress dashboard; an option many are not comfortable with. Sorely, a front-end profile editing system is conspicuous by its absence. Not to mention, the basic WordPress profile fields are a non-starter for any modern user profile foundation. And if that were not enough, adding to the misery, there’s no built-in system allowing you to add more user fields which are fundamental to any niche user-profiles website.
So how do you get yourself out of this bog? To be fair, it’s not that there is no system to build advance profiles within WordPress; On the contrary, there exists quite a robust structure under the hood to attach and maintain user data. It is called usermeta, short for WordPress User Metadata. All you need to know is some fancy bit of coding to unlock that. You can also use one of many available user meta plugins that can help you construct great looking profiles. Our very own — ProfileGrid is one such example, which not only empowers you to build any type of profiles but also adds user groups among other neat little things.

WordPress’s past as primarily a blogging tool

The default WordPress profile fields are stark reminders of WordPress’s past as primarily a blogging tool. It is still the core around which user profiles are built. Ergo, you cannot modify or remove these default fields. But WordPress offers APIs to attach as many data-fields to users, as you want.
It includes a set of functions to add, retrieve, and modify custom data to user accounts using usermeta key, value pairs. But creating a new usermeta key is not really synonymous with adding a new field to the user profile. Usermeta is used to store all kinds of information about a user which includes options only for admin’s eyes. For example, WordPress uses usermeta key wp capabilities to store access capabilities for a user. In short, user profile fields are just one of the things usermeta can be used for.
user profile fields
That is why you will need a user meta plugin that not only stores user profile fields as usermeta, but also retrieves and publishes them on the frontend as proper HTML. Since usermeta is WordPress’s preferred system for storing information about its users, it has added the advantage of being secure and egalitarian, when it comes to sharing data among plugins. If one plugin stores user information using usermeta, another plugin can easily retrieve and use it. Therefore, it was a no brainer for us when it came to deciding if RegistrationMagic should work with usermeta. The question was how.

WordPress Usermeta with RegistrationMagic forms

Since RegistrationMagic is a form-first system, we gave deep thought to how WordPress usermeta should work with our forms. From the very beginning, we wanted to display all the forms submitted by a user inside his or her profile in the admin area, but without actually going on to add every individual form field as usermeta. If we did that, you can imagine the commotion it would have wrought!
Honestly, it would not only create undue complications but adding all form fields to the user profile would be overkill as not all form fields make sense as part of user profiles. So, we decided to give you the power to store what you want as usermeta, and what to keep aside as clerical chaff. In fact, we decided to allow you to not only add a new usermeta but update the existing one created by one of your other plugins!

Adding an information table to default WordPress user pages

Let’s say you have a support form on your website powered by RegistrationMagic; and each time a user fills out that form, it’s fair to expect you would want it to automatically display inside his or her user profile in the admin area. So when you check out the user’s latest submission, you can also see quickly the past support requests by the same user.
RegistrationMagic achieves this by adding an information table to default WordPress user pages in the admin area where each table row corresponds to a form submission. This is a reasonably concise way of attaching multiple form entries to a single user page.
user profile fields
user profile fields
Now let’s assume your support form has a field which you want to be actually part of the user profile and update it every time user submits the form. This is where RegistrationMagic’s usermeta field mapping feature comes in. RegistrationMagic field mapping allows you to bind one of the fields of your RegistrationMagic form to a user usermeta key.
During the field creation process, you can select an existing usermeta key or create a new one and map it to the current field. You can also do this to multiple fields inside the same form. Whenever a user submits the form, all the fields mapped to usermeta will update the usermeta values from form values. As mentioned before, the form itself will be saved as a separate object inside the user page in a table, which can be downloaded or edited (Premium only feature) by the admin.

Let us have a closer look at this process:

Open RegistrationMagic in your dashboard and hover above the form card in which you wish to map a field(s) with usermeta. Click on the Fields button.
user profile fields
This will open a new page with the fields manager. Click on Add Field and select a field type from the popup. For sake of simplicity, we will select a plain text field. (If you plan on binding an existing field, please select Edit in front of that field.)
user profile fields
You will now reach the Field Options view. Click on Advanced Settings right at the bottom. It will expand into more settings.
user profile fields

Add Field to WordPress User Profile

In these newly visible settings, scroll down until you see Add Field to WordPress User Profile:
user profile fields
By default, Do not add will be selected. The next two options are — Associate with Existing WordPress User Meta Keys and Define New User Meta Key. Select, Associate with Existing User Meta Keys. This will introduce a new dropdown with searchable options. The dropdown lists all existing usermeta keys registered with WordPress on your site. Since there are technical limitations on the creation of usermeta keys (for example, there can be no spaces), they may look cryptic at first.
If you are not sure what a specific usermeta key does, just leave it alone. There’s a reason this option is hidden inside advance settings. We assume, at this stage, you are pretty sure which usermeta key you are looking for. Select it and save the field options.

Define your own (new) usermeta key

You can also define your own (new) usermeta key by selecting Define New User Meta Key. That will display a new text box:
user profile fields
You will be asked to name a new usermeta key which will be registered with WordPress upon saving. Usual restrictions on naming apply.
This is how you create or map existing usermeta keys to your RegistrationMagic Form fields. As stated before, you can map multiple fields inside a RegistrationMagic to multiple usermeta keys. This essentially means you can use RegistrationMagic forms to allow your website users to update their profiles created with another plugin. But using this method, you will also have the opportunity to add non-user WordPress profile fields (like a reason for updating) and turn each update into a report. Combine this with ProfileGrid and possibilities are endless. You can create single field forms to update specific fields, save forms inside ProfileGrid tabs, and more.

Important notes and things to take care of

But there are a few things you should always remember while using this process:
  1. Be sure to check the expected values for the existing usermeta key. If another plugin expects the value to be a number, you have to bind it to the RegistrationMagic Number field and so on.
  2. There are restrictions on how you name a new usermeta key.
  3. Once a value is saved inside usermeta table, any other plugin can retrieve it.
  4. A usermeta key is registered for all users and not for a single user. Although the value can be defined only for one.
  5. Avoid mapping with usermeta key used by WordPress to store options unless you are completely sure what you are doing.
  6. RegistrationMagic has an in-built system to display form data on the front end. But to convert it into a full-fledged profiles and membership system, you will need a plugin like ProfileGrid.
  7. RegistrationMagic allows you to display a field from the form on the frontend user area without registering it as usermeta key. Use this for simpler scenarios to avoid adding unnecessary keys to your system.
  8. Following keys are reserved for WordPress Core and cannot be used as part of usermeta system:
    1. user_login
    2. user_pass
    3. user_nicename
    4. user_email
    5. user_url
    6. user_registered
    7. user_activation_key
    8. user_status
    9. display_name

RegistrationMagic field types

Another important thing to remember — some RegistrationMagic user profile field types are pre-mapped to usermeta keys. Use them wherever possible instead of mapping to new generic field types. Pre-mapped fields are already configured to save and retrieve usermeta values in the most suitable format. These WordPress profile fields are:
RegistrationMagic Field Type
Mapped to (usermeta key)
First Name
first_name
Last Name
last_name
Biographical Info
description
Nickname
nickname
Website
user_url

A word about WooCommerce

A word about WooCommerce – like other native WordPress plugins, WooCommerce too uses usermeta system to store information about customers. RegistrationMagic has three Field Types pre-mapped to composite WooCommerce usermeta keys. It means the values from RegistrationMagic WooCommerce user profile fields will be interspersed to different WooCommerce usermeta keys automatically, billing phone number being an exception.
RegistrationMagic Field Type
Mapped to (usermeta key)
WooCommerce Billing Field
billing_last_name
billing_company
billing_address_1
billing_address_2
billing_city
billing_state
billing_postcode
billing_country
billing_email
WooCommerce Shipping Field
shipping_first_name
shipping_last_name
shipping_company
shipping_address_1
shipping_address_2
shipping_city
shipping_state
shipping_postcode
shipping_country
Billing Phone Number
billing_phone
We hope this guide to add user profile fields will bring you one step closer to becoming a WordPress power user. If we missed anything, or you want us to add new features to the RegistrationMagic usermeta mapping system, do not forget to let us know in the comment section.

About RegistrationMagic

RegistrationMagic Editorial Staff (rmagic) is a team of WordPress registration experts and major contributor to the development of RegistrationMagic - WordPress User Registration Plugin.
Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments