Created
June 22, 2019 01:53
-
-
Save leepettijohn/aaea584a8a3014d3ec3a2f6a65d1ab64 to your computer and use it in GitHub Desktop.
Gravity Forms - Update User Info Meta and Password
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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