[TYPO3-english] Switch to other frontend user

Richard Davies richard at ocular.co.nz
Mon Mar 12 10:09:08 CET 2012


Hi

Best idea would probably be log the user off and then log them on as the
other user. To manually log a user on:
$where = ....
$user = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
                '*',
                'fe_users',
                $where
                );
                if($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($user)){
                    //thanks to sociallogin2t3
                    $fe_user = $GLOBALS['TSFE']->fe_user;
                    $fe_user->createUserSession($row);
                    $fe_user->loginSessionStarted = TRUE;
                    $fe_user->user = $fe_user->fetchUserSession();
                    $GLOBALS["TSFE"]->loginUser = 1;
                    //$this->loginSessionStarted = TRUE;
                } else {
                    //user fetch failed
                }

As you can see by the comment, I've used the code from sociallogin2t3 here.

Richard


On 12 March 2012 21:45, Iban Cardona i Subiela <icardona at serialnet.net>wrote:

> Hello,
>
> I have a question about making a action in my frontend plugin.
> I have a frontend user logged in my frontend plugin. I would like that
> after click in a button, switch to other feuser.
> Does anyone know how can I? What code should I put on my frontend plugin?
>
> Thank you so much.
>
> --
> _______________________________________________
> TYPO3-english mailing list
> TYPO3-english at lists.typo3.org
> http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-english
>


More information about the TYPO3-english mailing list