Skip to content

Instantly share code, notes, and snippets.

@speedguy
Last active September 28, 2016 02:15
Show Gist options
  • Select an option

  • Save speedguy/7213596 to your computer and use it in GitHub Desktop.

Select an option

Save speedguy/7213596 to your computer and use it in GitHub Desktop.
Using user_register hook in Wordpress
add_action('user_register', 'my_new_member');
function my_new_member($user_id) {
global $wpdb;
//Example of how to get the fields submitted via the form
if (isset($_POST['first_name'])) {
$firstname = $_POST['first_name'];
}
else {
$firstname = '';
}
//Adjust based on your specific columns
$data = array (
'user_id' => $user_id,
'first_name' => $firstname,
);
//Adjust with name of your database table
$wpdb->insert('wp_my_crm_data', $data);
}
@time-wcrp
Copy link

time-wcrp commented Sep 28, 2016

Many thanks.

Note

$info = get_userdata($user_id);
$info->first_name;
$info->last_name;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment