Programmatically log in a user
I have tried using User::loginByUserID($userID) documented here,http://www.concrete5.org/documentation/developers/permissions/users... it does not work with or without a redirect after it.
How can this be done?
//where $user is User object of the user to login $u = new User; $u->loginByUserID($user->getUserID());
Make sure you aren't doing
$u = new User; $u->loginByUserID($u->getUserID());
As this is going to log in the current user not the other user.
With the call to logout it worked!
Thank you :)
But technically, it could go anywhere.
So, I have set up custom registration pages (multilingual site), using jbs "register pro" add-on, which is just overriding the core registration function/controller etc.
So within the package files, the code is very similar to the core registration controller.
What I want to achieve is:
User registers to site -> User is added to group. Now the user shall be redirected to another page where he can choose some other options (purchase products etc.)..
All the steps are set up, but the user needs to log in to arrive at the last step, so that the purchase can be connected to the user data. I would like to jump over that and just have it as a flowing process.
From this thread, it seems like I just need to put some lines of code into two places... well :-)
Thanks for the reply!
Yes you just need to take the code from above and insert it into the register controller, once the user has been created.