1
votes

I want to call a function to get user_id, user name & email when a new user is created (after user filling username, email at register form & submit). Any a hook can make it? Thanks

2

2 Answers

0
votes

get user's infomation do like this:

global $current_user
get_currentuserinfo();
echo 'Username: ' . $current_user->user_login . "\n";
echo 'User email: ' . $current_user->user_email . "\n";
echo 'User first name: ' . $current_user->user_firstname . "\n";
echo 'User last name: ' . $current_user->user_lastname . "\n";
echo 'User display name: ' . $current_user->display_name . "\n";
echo 'User ID: ' . $current_user->ID . "\n";

$current_user variable is a object.

It is instanceof WP_User.

the class of WP_User was provided properties, you can see it in /wp-include/capabilities.php

0
votes

you can use action hook user_register and bind your function with it.