简体   繁体   中英

How do i force Joomla to update the user session

I'm updating the ACL for a given user on a PayPal callback. I'm doing this by updating the #__user_usergroup_map table directly. Now i need the user session to be updated with the new information without logging out and in again.

From this question 's answers i tried the following:

$user = JFactory::getUser();
$session = JFactory::getSession();
$session->set('user', new JUser($user->id));

However this does not work for me and from JUser it looks like JUser has been deprecated.

Can anyone hint me in the right direction?

I realized that the answer from the other question will actually work.

$user = JFactory::getUser();
$session = JFactory::getSession();
$session->set('user', new JUser($user->id));

The reason it wouldn't update the user session in my case is that this code was called on the callback from PayPal which do not hold the user session.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM