ISSUE
display name and website fields do not update -- User Registration Add-on 1.5beta1
STEPS TO REPRODUCE ISSUE
- Create form with name and website fields.
- Create an "update user" feed pointing to the form
- set Display Name to
{first name}{last name}
- set Website (under User Meta) to your website field
- set Display Name to
- Embed form and test whether it updates the values for display name and website.
My setup: WP 3.5.1, vanilla Twenty Twelve theme, GF 1.6.12, User Registration Add-on 1.5beta1, no other plugins active
APPARENT PROBLEM
Look in userregistration.php, GFUser::update_user(), on line 2184: self::add_user_meta($user_obj->ID, $config, $form, $lead, array());
. This appropriately updates the user meta with the data submitted by the form. The problem appears to be on the very next line, line 2185: $user_id = wp_update_user($user);
. This updates the user meta again, overwriting the new data with the old $user
data.
Note: If you want to debug with var_dump() etc. in GFUser::update_user(), turn off ajax for the form.
APPARENT FIX
For the GF devs: I'm guessing that the logical solution would be to prevent the overwriting of the updated data. The user id still needs to be passed to the $user_id
variable, so line 2185 could be replaced with $user_id = $user_obj->ID;
. This seems to make everything work correctly for me, but time will tell whether it creates more problems.
For those that don't want to hack the GF files: (I haven't tested these other ideas.) A different workaround may be to update the user meta data using the (at present undocumented?) gform_user_updated action hook, which fires just after the code above, on line 2191: do_action('gform_user_updated', $user_id, $config, $lead, $user_data['password']);
. Another option may be to use the gform_after_submission hook as suggested here when another GF user noticed the display name failing to update.