Plugin Support
Towhid
(@cryptex_vinci)
This does not work, because no normal form is displayed on the profile page. The profile page that the plugin created after installation had this shortcode in it:
[ultimatemember_account]
It’s not a normal form that you can edit in the form editor, right?
Edit: I figured it out. It seems I can do it with this code:
http://hookr.io/filters/um_account_secure_fields/
-
This reply was modified 4 years, 1 month ago by polymathy.
-
This reply was modified 4 years, 1 month ago by polymathy.
-
This reply was modified 4 years, 1 month ago by polymathy.
The only problem with above code is, that even though I get the field I desired, I can’t save the field. Saving doesn’t seem to work.
The solution from the link above doesn’t seem to work anymore. So I used this solution:
https://www.champ.ninja/2020/05/add-a-custom-account-tab-with-profile-form-fields/#comment-35
Now I have a custom tab on my profile page where can add my own profile form. I used the default fields user_login, first_name, last_name, user_email as well as my own custom field user_title.
The problem now is, user_login and user_email don’t show up in my form. What could be the reason for this? Also when I click save, I get the error message “This is not possible for security reasons”. I already checked for any plugin/theme compatibility issues, but there are none.
I finally figured out how it works. So if anyone else has the same issue, I added the following code, which I found in this thread:
/**
* Add extra fields to user account tab
*/
function showUMExtraFields()
{
$id = um_user('ID');
$output = '';
$names = array('gender', 'therapy_center');
$fields = array();
foreach ($names as $name)
$fields[$name] = UM()->builtin()->get_specific_field($name);
$fields = apply_filters('um_account_secure_fields', $fields, $id);
foreach ($fields as $key => $data)
$output .= UM()->fields()->edit_field($key, $data);
echo $output;
}
add_action('um_after_account_general', 'showUMExtraFields', 100);
/**
* Get content for extra fields in user account tab
*/
function getUMFormData()
{
$id = um_user('ID');
$names = array('gender', 'therapy_center');
foreach ($names as $name)
update_user_meta($id, $name, $_POST[$name]);
}
add_action('um_account_pre_update_profile', 'getUMFormData', 100);
You can also use this for custom fields, that are not from the default set of fields. You will have to create the field and then use the meta key you specified in the form editor.
Hi @polymathy
Thanks for letting us know how you resolve the issue. I am closing this thread now.
Regards,