We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
  • I have an issue...I’m more inclined to thing it’s me than a bug...

    I have two web user groups, and one document group.? Both web user groups are linked to the same document group.

    Web user group 1, and web user group 2.

    When I do a check of the SESSION value for web groups for the user who is a member of BOTH groups, I get this:

    Array
    (
    ? ? [ 0 ] => 1
    ? ? [ 1 ]? => 1
    )
      Studying MODX in the desert - http://sottwell.com
      Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
      Join the Slack Community - http://modx.org
    • Ok, I see what the issue is here. The SESSION variable is filled with documentgroup data; I’m using webgroup data. Although I still think that in this case, the "1" should only occur once in the array. (nitpick, nitpick...)
        Studying MODX in the desert - http://sottwell.com
        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
        Join the Slack Community - http://modx.org
        • 32963
        • 1,732 Posts
        Quote from: sottwell at Jun 08, 2005, 12:44 PM

        Ok, I see what the issue is here.? The SESSION variable is filled with documentgroup data; I’m using webgroup data.? Although I still think that in this case, the "1" should only occur once in the array.? (nitpick, nitpick...)

        Thanks for the feedback. Try using the $modx->isMemberOfWebGroup() function
          xWisdom
          www.xwisdomhtml.com
          The fear of the Lord is the beginning of wisdom:
          MODx Co-Founder - Create and do more with less.
        • Quote from: xwisdom at Jun 08, 2005, 04:16 PM

          Thanks for the feedback. Try using the $modx->isMemberOfWebGroup() function

          Yes, that would be OK for one or two queries. But the docgroups is put in the SESSION so the database doesn’t have to get hit at every page to see if the user has permission to view the page; likewise the usergroups being queried and loaded into SESSION once at login would relieve the database from being queried every time you need to check for any given usergroupl

          This particular "webapp" snippet (docman) can get away with one query, but others could require being members of a number of groups, and it could require a check on several pages. So I still think having it in SESSION and only having to do an in_array() for each check is better than having to query the database every time.

          Actually, I suppose this isn’t a bug, but more of a feature request!
            Studying MODX in the desert - http://sottwell.com
            Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
            Join the Slack Community - http://modx.org