Hello!
I know there are several post about this, but none of them have helped me. I simply want to auto login users after they have submitted a user registration form.
I see that a number of people are using this code, but its not working:
add_action( 'gform_user_registered', 'pi_gravity_registration_autologin', 10, 4 );
02
/**
03
* Auto login after registration.
04
*/
05
function pi_gravity_registration_autologin( $user_id, $user_config, $entry, $password ) {
06
$user = get_userdata( $user_id );
07
$user_login = $user->user_login;
08
$user_password = $password;
09
10
wp_signon( array(
11
'user_login' => $user_login,
12
'user_password' => $user_password,
13
'remember' => false
14
) );
15
}
I added the above code at the end of my functions.php. Is there anything else thats needs to be done?
All that happened when I added the code was my login got broke. When I go to domain.com/wp-login.php and enter user and password and hit login, I just come to a blank page.
Any input would be lovely.