Im building a plugin for wordpress. I want to creat a row in a custom database table i have created called jp_test. I need the wordpress user ID in my custom table. My code do far is in the plugin index file but I have tried it in the theme functions.php too and it still doesnt work. can anyone suggest anything?
function add_to_jp( $user_id ) {
global $wpdb;
$jp_data = array(
'wp_user_ID' => $user_id,
'jp_email' => '',
'jp_telephone' => '',
'extra' => ''
);
$wpdb->insert( 'jp_test', $jp_data);
}
add_action( 'user_register', 'add_to_jp)');