Skip to content

Instantly share code, notes, and snippets.

@leepettijohn
Created June 22, 2019 01:53
Show Gist options
  • Save leepettijohn/aaea584a8a3014d3ec3a2f6a65d1ab64 to your computer and use it in GitHub Desktop.
Save leepettijohn/aaea584a8a3014d3ec3a2f6a65d1ab64 to your computer and use it in GitHub Desktop.
Gravity Forms - Update User Info Meta and Password
add_action( 'gform_post_submission_6', 'update_user_info', 10, 2 );
function update_user_info( $entry, $form ) {
$userid = rgar($entry,'6');
$email = rgar($entry,'5');
$first_name = rgar($entry,'1.3');
$last_name = rgar($entry,'1.6');
$company = rgar($entry,'4');
$address = rgar($entry,'3');
$password = rgar($entry,'7');
$user_id = wp_update_user( array(
'ID' => $userid,
'first_name' => $first_name,
'last_name'=>$last_name,
'user_email'=>$email
) );
if (!empty($password)){
$updatethisuser = wp_update_user(array(
'ID' => $userid,
'user_pass' => $password
));
}
update_field('client_company',$company,'user_'.$userid);
update_field('client_address',$address,'user_'.$userid);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment