WPCrm readd forceLogin()

This commit is contained in:
Jérémy Munsch 2022-02-10 16:43:58 +01:00
parent 647ac8acb5
commit 61aeca5e31
No known key found for this signature in database
GPG key ID: 55196BEE445F6049

View file

@ -85,6 +85,21 @@ class WPCrm
return self::$user;
}
/**
* Manually login a user
* If self::$user is already set.
*
* @return \LDCCRM\WPCrmUser|null
*/
public static function forceLogin()
{
self::bootSessionIfNeeded();
if ($user = self::getUser()) {
$_SESSION['wpcrm'][self::$sessionKey] = json_encode($user);
}
return $user;
}
/**
* Get the current user
* return api response code if an error occurs