Created
March 2, 2016 10:53
-
-
Save checkerap/2ea051a027cfa1b4aa09 to your computer and use it in GitHub Desktop.
Login a user in a typo3 extenbase extension
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// now login the user | |
$fe_user = $GLOBALS['TSFE']->fe_user; | |
$fe_user->createUserSession(array('uid' => $uid)); | |
$fe_user->user = $fe_user->getRawUserByUid($uid); | |
$fe_user->fetchGroupData(); | |
$GLOBALS['TSFE']->loginUser = 1; | |
// set the cookie | |
$reflection = new \ReflectionClass($GLOBALS['TSFE']->fe_user); | |
$setSessionCookieMethod = $reflection->getMethod('setSessionCookie'); | |
$setSessionCookieMethod->setAccessible(TRUE); | |
$setSessionCookieMethod->invoke($GLOBALS['TSFE']->fe_user); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment