I have created the following wordpress function to save a form created in Gravity Forms to the usermeta database based on one I had working for CF7 but it isn’t working, hopefully someone can see where I’ve made a mistake. It needs to update the current users fields.
add_action('gform_after_submission', 'input_fields', 10, 2);
function input_fields($entry, $form){
$name = $entry['1'];
$email = $entry['4'];
global $wpdb, $current_user;
$wpdb->insert(
'usermeta',
array(
'description' => $email,
'former_name' => $name
)
);
}
I’ve seen other examples which are pretty much identical so i’m a bit stuck.
This should do the trick:
Alternately, I’d recommend upgrading to a Developer license and getting access to the User Registration add-on which would do this even more easily. 🙂
Semicolon sign “;” is missing at line 8 so this is right the answer. 🙂