0

add_action( 'gform_user_registered', 'inf_gravity_registration_autologin',  10, 4 );
/**
 * Auto login after registration.
 */
function inf_gravity_registration_autologin( $user_id, $user_config, $entry, $password ) {
 $user = get_userdata( $user_id );
 $user_login = $user->user_login;
 $user_password = $password;
       $user->set_role(get_option('default_role', 'subscriber'));
     wp_signon( array(
  'user_login' => $user_login,
  'user_password' =>  $user_password,
  'remember' => false
     ) );
}

Jagdish Sarma Asked question July 7, 2021
Add a Comment