Problems with saving custom field on extended account tab
-
Guys, I’m going slightly mad ’cause I’m still struggeling with the own account tab thing. So please, I need your help…
I’m using UM 2.0.25 free version with WP 4.9.8
I’m looking for a solution to save a custom field on an extended account tab. The code I’ve found here doesn’t work properly: https://gist.github.com/champsupertramp/c1f6d83406e9e0425e9e98aaa36fed7d
add_action('um_after_account_general', 'showUMExtraFields', 100); function showUMExtraFields() { $id = um_user('ID'); $output = ''; $names = array('phone_number', 'company'); $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_account_pre_update_profile', 'getUMFormData', 100); function getUMFormData(){ $id = um_user('ID'); $names = array('phone_number', 'company'); foreach( $names as $name ) update_user_meta( $id, $name, $_POST[$name] ); }
After updating the custom field the meta_value is “0” or “1” but not the value of my custom field.
So where is the mistake?
Thanks a lot for help in advance!!
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Problems with saving custom field on extended account tab’ is closed to new replies.