1
nachenko
update user permissions on the fly, without login out
  • 2007/2/7 13:00

  • nachenko

  • Quite a regular

  • Posts: 356

  • Since: 2005/1/18


Hi!

I just wrote a script that checks whether a user fulfilled a form (created using Formulaire module). If it is the case, it checks whether this user belongs to a group we could name "special registered users", so to say.

IF the user belongs to this group, then it goes to a "special news category".

If it doesn't, the script adds this user to this user group and then goes to the "special news category".

And here's the problem: the user is added to the groups database succesfully, but it has to log out and then login for the changes to take effect. It seems like the $xoopsUser object not updating until login on again.

After lots of tries I now this is exactly the problem: the new groups and permissions of this user don't apply until he/she logs out and in again. $xoopsUser object doesn't update while in a session.

What can I do?

Thanks.

2
nachenko
Re: update user permissions on the fly, without login out
  • 2007/2/7 13:06

  • nachenko

  • Quite a regular

  • Posts: 356

  • Since: 2005/1/18


OOpa, I see $_SESSION data is not updating.

$xoopsUser->setGroups($grupos) is not working as I expected, it updates the $xoopsUser object but not the session.

3
nachenko
Re: update user permissions on the fly, without login out
  • 2007/2/7 13:14

  • nachenko

  • Quite a regular

  • Posts: 356

  • Since: 2005/1/18


Ooopa, fixed.

But in a very dirty way:

Quote:

// add to group 15 for this session
array_push ($_SESSION['xoopsUserGroups'], "15");


Any cleaner one?

Login

Who's Online

243 user(s) are online (163 user(s) are browsing Support Forums)


Members: 0


Guests: 243


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: May 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits