Here’s what to do in order to add custom fields to the account page.
/* Add fields to account page */
add_action('um_after_account_general', 'showExtraFields', 100);
function showExtraFields()
{
$custom_fields = [
"alternate_email" => "Permanent E-mail Address",
"major" => "Major",
"minor" => "Minor",
"gpa" => "GPA",
"graduation_year" => "Graduation Year",
"graduation_season" => "Graduation Season",
"gpa" => "GPA",
"phone_number" => "Phone Number (XXX-XXX-XXXX)",
"address_1" => "Permanent Address 1",
"address_2" => "Permanent Address 2",
"city" => "City",
"state" => "State",
"zip_code" => "Zip Code"
];
foreach ($custom_fields as $key => $value) {
$field_value = get_user_meta(um_user('ID'), $key, true) ? : '';
$html = '<div class="um-field um-field-'.$key.'" data-key="'.$key.'">
<div class="um-field-label">
<label for="'.$key.'">'.$value.'</label>
<div class="um-clear"></div>
</div>
<div class="um-field-area">
<input class="um-form-field valid "
type="text" name="'.$key.'"
id="'.$key.'" value="'.$field_value.'" placeholder=""
data-validate="" data-key="'.$key.'">
</div>
</div>';
echo $html;
}
}
Thanks for helping out other users on the forum 🙂
This will work only with textfields, not with select, checkbox, etc.
Is there a way I can retrieve those values somewhere to further edit them?
I’m have the same requirement and I can’t seem to find any answers for it, aside from programming our own solution. You offer the ability to create custom forms and plugins, but not a way to retrieve / edit that data in the profile view? Would love to at least know how to accomplish this even if it’s a custom programming solution.
Thanks