We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 37111 ☆ A M B ☆
    • 31 Posts
    Hey Guys,
    in my actual project, there are three types of users in the frontend (seperated by different user-groups in the manager): the companies, the trainees and the admins.

    Normaly, a trainee-account will not become an company-account in a real world scenario, but for testing, I've done this exactly.

    I have a snippet, whichs gets the usertype via $user->isMember($usergroup) and returns the correct usertype by checking if the user is member in one of the three usergroups.

    My test was the following:
    At the start, I have got a user in the usergroup "trainee" - and my snippet says that he/she is a trainee. Correct.
    Now, I have deleted that membership of the trainee-usergroup for that user in the manager and saved. My (uncached) snippet says, that he/she is still a trainee. Incorrect.
    After that I have added the User to the usergroup "company", but after saving and reloading, my snippet gets the information from $user->isMember('trainee') back, that the user is still a trainee - not a company. Defenetly incorrect.

    I've also tried to clear the cache and refresh the rights (Menu > Security), but nothing changes. And a logout in the frontend + new login in the frontend also doesn't change anything.
    Is there another way to check if a user in a certain usergroup? Or do I have to get that done with a direct SQL-Query by myself?

    Cheers and thanks! smiley
    Greetings from Germany
    Jens [ed. note: vamporio last edited this post 13 years, 7 months ago.]
      • 3749
      • 24,544 Posts
      Another user recently solved this exact problem with code that modifies the cached session data for the user. Unfortunately, I can't remember any more than that. I think the post was not more than 3 or 4 days ago (probably less).
        Did I help you? Buy me a beer
        Get my Book: MODX:The Official Guide
        MODX info for everyone: http://bobsguides.com/modx.html
        My MODX Extras
        Bob's Guides is now hosted at A2 MODX Hosting