That action no longer exists. Use register_new_user instead.
thanks for your reply Jeff,
I try to insert this code
<?php
function register_new_user( $user_id ) {
wp_set_auth_cookie( $user_id, false, is_ssl() );
wp_redirect( 'http://www.leinontirovina.com/area-privata' );
exit;
}
add_action( 'register_new_user', 'register_new_user' );
?>
but it shows me this error
“Fatal error: Cannot redeclare register_new_user() (previously declared in ********/wp-includes/user.php:2212) in *****/wp-content/plugins/theme-my-login-custom.php on line 2
What’s wrong?
Ok. I solved it.
For everyone will have the same problem on WP 4.5.1. this is the the correct way:
create the file theme-my-login-custom.php
code to insert
<?php
function auto_login_new_user( $user_id ) {
wp_set_current_user($user_id);
wp_set_auth_cookie($user_id);
wp_redirect( 'http://www.example.com/' );
exit;
}
add_action( 'user_register', 'auto_login_new_user' );
?>
upload it on /wp-content/plugins/
Hello, your function works however stopped sending e-mail with the confirmation registration for user and admin
Add your custom function to a higher priority:
add_action( 'user_register', 'auto_login_new_user', 15 );
I also wanted to auto log in the user upon registration, and encountered the same problem, that the email confirmations broke. So I added one line of code that made the email confirmations work (see 5th line):
<?php
function auto_login_new_user( $user_id ) {
wp_set_current_user($user_id);
wp_set_auth_cookie($user_id);
wp_new_user_notification( $user_id, null, 'both' );
wp_redirect( 'http://www.example.com' );
exit;
}
add_action( 'user_register', 'auto_login_new_user' );
?>
HOWEVER, now the email notifications are coming from the default WP setting, NOT the TML custom emails. How can I send the TML emails?
Did you see the last thing I said in this thread? 😉