I want to make a copy of user ID and name into my own database when new user registers. So I edit the register_new_user function in wp-login file.
...
...
function register_new_user($user_login, $user_email) {
...
...
wp_new_user_notification($user_id, $user_pass);
// my code starts.
$con = mysql_connect("localhost","mydatabase","mypasswd");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("test", $con);
$sql="INSERT INTO Registered_User_Test (ID, Name, Email)
VALUES
('$user_id','$user_login','$user_email')";
if (!mysql_query($sql,$con))
{
die('Error: ' . mysql_error());
}
mysql_close($con);
//my code ends.
return $user_id;
}
But it doest work.
Anyone who knows how to do that?
Thanks