I bring this issue up here because I have needed this to work on two different sites in the last week and have been unable to get it to work. I am using the following code to log in a user after registration, but no matter how much tinkering I do, it just does not log the user in! Any ideas what I’m doing wrong here?
function jh_gravity_registration_autologin( $user_id, $feed, $entry, $password ) {
if ( !is_user_logged_in() ) {
$user = get_userdata( $user_id );
wp_signon( array(
'user_login' => $user->user_login,
'user_password' => $password,
'remember' => false
) );
}
}
add_action( 'gform_user_registered', 'jh_gravity_registration_autologin', 10, 4 );
Any ideas would be greatly appreciated!