Guest user login as a registered user

Permalink
cannot seem to get Guest account to login as a registered account in the system

$uID = 2;
$u = new User();
$u->logout();

$u->loginByUserID($uID); //does not work

$u->logIn(); //does not work

$u = User::getByUserID($uID, true);//does not work

DvB
 
mnakalay replied on at Permalink Reply
mnakalay
try
User::loginByUserID($uID);
DvB replied on at Permalink Reply
DvB
that works if it's the only usage of User on the top of the page.

I'm checking if a user exists or not then create the user update some database information then login as the user and redirect to appropriate page depending on group

right now I can only do it by storing the userID in cookie then sending to a dispatcher page which which picks up the userID login as user then check group and redirect

was hoping to reduce redirects
mnakalay replied on at Permalink Reply
mnakalay
Maybe don't do it on the page, do it in the on_start event (event not function) either from a package's controller or in application/bootstrap/app.php
DvB replied on at Permalink Reply
DvB
I'm doing it from a single_page

I probably just have to divide up the process etc, but don't want to pass any GET parameters/cookies
mnakalay replied on at Permalink Reply
mnakalay
If it's from a single page, you can do it from the page's controller in the on_start function this time.

Would you mind posting your whole code here? I might be able to help