• Resolved backopio

    (@backopio)


    Hi,
    I’m having trouble with my users profile update feature.

    Though the success message “Profile has been updated” is shown, as a matter of fact it’s not : the new values filled in the form are not saved.

    Note that the config is ok and users have permission to modify their profile.

    After a look at my code, there may be a problem with “um_account_secure_fields” which only contains “user_login” (when displaying corresponding array values) and no other field. I’m not sure about the understanding of this “um_account_secure_fields” but my guess is there should be all the fields i want to update, right ?

    So i searched for the bit of custom code that displays these fields :

    function _get_ea_profile_fields(){
        $user_id = um_user('ID');
    
        UM()->fields()->editing = true;
    
        if($profile_form_id = _get_ea_um_profile_form_id()) {
          $post_data = UM()->query()->post_data($profile_form_id);
          if(!empty($post_data['custom_fields'])) {
            $fields = unserialize( $post_data['custom_fields'] );
            $fields = apply_filters( 'um_account_secure_fields', $fields, $user_id );
            uasort($fields, function ($a, $b) {
              if(!isset($a['position']) || !isset($b['position'])) {
                return 0;
              }
              if($a['position'] == $b['position']) {
                return 0;
              }
              return ($a['position'] < $b['position']) ? -1 : 1;
            });
    
          }
        }
    
        return $fields;
      }

    I thought that $fields = apply_filters( 'um_account_secure_fields', $fields, $user_id ); would add the fields to the secure_fields array, but apparently, it’s not doing anything.
    Of course, i have a certain amount of custom fields in the $fields array, and they are very well displayed on the frontend form. And the $user_id value is ok too.

    Do you have any idea on how to fix this please ?

Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Update profile’ is closed to new replies.