Skip to content

Instantly share code, notes, and snippets.

@mattboon
Created October 8, 2012 17:02
Show Gist options
  • Save mattboon/3853620 to your computer and use it in GitHub Desktop.
Save mattboon/3853620 to your computer and use it in GitHub Desktop.
Fublo Edit Profile function
<?php
function fublo_gf_profile_update( $entry, $form )
{
// make sure that the user is logged in
// we shouldn't get here because the form should check for logged in users...
if ( !is_user_logged_in() )
{
wp_redirect( home_url() );
exit;
}
// get current user info...
global $current_user;
get_currentuserinfo();
// do the user data fields...
$new_user_data = array(
// these are the ID numbers of these fields in our GF
'ID' => $current_user->ID,
//'user_login' => $entry['8'],
'user_email' => $entry['8'],
//'user_pass' => wp_hash_password('hello'),
'user_pass' => wp_hash_password($entry['9']),
'user_title' => $entry['3'],
'first_name' => $entry['2.3'],
'last_name' => $entry['2.6'],
'user_degree' => $entry['5'],
'user_sponsor' => $entry['6'],
'user_region' => $entry['13'],
'user_interest' => $entry['14'],
'user_affiliation' => $entry['15'],
'user_address1' => $entry['16'],
'user_address2' => $entry['17'],
'user_city' => $entry['18'],
'user_state' => $entry['19'],
'user_postcode' => $entry['20'],
'user_country' => $entry['21'],
'user_telephone' => $entry['22'],
'user_url' => $entry['23'],
);
// ----------------------------------------------- SAVE ALL THE THINGS
wp_update_user( $new_user_data );
}
add_action( 'gform_after_submission_' . FUBLO_GF_PROFILE, 'fublo_gf_profile_update', 100, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment