• Hello,
    I created a custom field in My account page – the mobile number. Problem is when I click update with a new phone number, in frontend the mobile number is changing, but the new data is not saved in the database. How can I update the mobile number properly? Because I have another custom code that allows users to login via mobile number and is very important to have everything work properly.

    function my_um_account_mobile( $args, $shortcode_args ) {
    
        $args .= ',mobile_number';
        return $args;
        $to_update[] = array('mobile_number' =>  $value);
        um_update_profile($to_update);
        update_user_meta( $user_id, 'mobile_number', $args);
        UM()->user()->remove_cache( $user_id );
    }
    
Viewing 1 replies (of 1 total)
  • Plugin Support Ultimate Member Support

    (@ultimatemembersupport)

    Hi @ancazpz

    Thanks for contacting our support!

    Please try the following code with changes:

    function my_um_account_mobile( $args, $shortcode_args ) {
    
        $args .= ',mobile_number';
        
        $to_update[] = array('mobile_number' =>  $value);
        um_update_profile($to_update);
        update_user_meta( $user_id, 'mobile_number', $value);
        UM()->user()->remove_cache( $user_id );
    
        return $args;
    }
Viewing 1 replies (of 1 total)

The topic ‘Update custom field in database’ is closed to new replies.