Login with Email and Remember option.

if( isset($_REQUEST[‘action’]) && $_REQUEST[‘action’]==’maillogin’ )

{

$email = $_REQUEST[‘usermail’]; //username.

$password = $_REQUEST[‘password’];

$remember = $_REQUEST[‘remember’];

$userdata = get_user_by(’email’,$email);

$creds = array();

$creds[‘user_login’] = $userdata->data->user_login;

$creds[‘user_password’] = $password;

$creds[‘remember’] = $remember;

$user = wp_signon( $creds, true );

if ( is_wp_error($user) ){

//echo $user->get_error_message();

echo “false”;

}

else{

echo “true”;

}

}

 

Leave a Reply