We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 3749
    • 24,544 Posts
    Quote from: IG88 at Jul 23, 2008, 06:01 AM

    BobRay,

    I have tested it with 3 groups and 3 chunks and a default. This is working perfectly, and even though I can see the additions you made it seems to be working better than both originals.

    I am not sure what you mean by more complex setups, except unless you mean just more numerous groups and chunks, but I can not see why it would not work.

    Even though I was very close and I almost did what you did at one point, I do not think I could have figured it out on my own anytime soon without you. I told you in PM and I will say so in public that you are a very helpful soul. Since the first day I posted here looking for help you offered the best advice and your newbie site was the absolute best and most comfortable site of information I came across. I can not thank you enough.

    This snippet is very useful. Since Modx uses groups and chunks so much in so many set ups, it seems logical to me that this should be included in future releases of Modx. It should be considered a part of it.


    Thank you. I’m glad it worked for you.

    One test I didn’t try involves using multiple groups but only one chunk. It should show the chunk to anyone in any of the groups and the default chunk (if any) to others.

    The snippet doesn’t play very nice with the upcoming version of MODx (MODx Revolution). If I have time, I’ll see if I can adapt it, but I want to make sure the code is solid first.

    Bob
      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
      • 3388
      • 3 Posts
      Hi All - I’m having an issue with extmembercheck, and I’m hoping I’m not alone / someone has encountered and solved this.

      here is my call:

      [!extMemberCheck? &groups=`[*DepositGroupName*],[*WebGroupName*]` &chunk=`DepositFormApproved,DepositForm` &default=`unregisteredDeposit` &debug=`true`!]

      pretty straightforward.. This call sits on a template, that includes, among others, the two TV’s shown above. When visitors are members of a specified group, they get a credit card payment form generated by a snippet inside the {{DepositForm}}. once they pay, they are added to the group that correlates to the DepositGroupName TV, and will then see the {{DepositFormApproved}}

      This all works... almost. The problem is that extmembercheck doesn’t seem to REFRESH! As I check and uncheck my group memberships, it will only display the latest group in the hierarchy at the time I logged in. So if I’m in the webgroupname group.. I’m there for the remainder of my session. it doesn’t honor the fact that I’ve now joined a higher group. I have the same problem in reverse.. it will not demote me if I uncheck my depositgroupname membership and refresh.

      Does anybody have any ideas? I’ve tried this in every possible permutation I can think of.. cached and uncached snippet calls, cached and uncached pages, inside chunks, on pages, I’ve even tried it without tv’s and the group names spelled out. NOTHING!

      Any ideas? Am I missing something?

      Many Thanks,

      Billy D


        • 3388
        • 3 Posts
        OK, so after some sleep - I solved my problem. To those interested, I included this in my snippet that occurs after my form processes and assigns group membership:

        if (array_key_exists(’webUserGroupNames’, $_SESSION)) {
        unset($_SESSION[’webUserGroupNames’]);
        }

        worked like a charm!

        Billy D
          • 4971
          • 964 Posts
          Does this checks for managers?
          or only web user groups...
            Website: www.mercologia.com
            MODX Revo Tutorials:  www.modxperience.com

            MODX Professional Partner
            • 3388
            • 3 Posts
            My process is only meant for web users, so managers weren’t a consideration when i made this.

            What I’m doing is clearing the session variable set by extmembercheck, and extmembercheck uses the isMemberOfWebGroup() function. I looked up that function in the wiki, and in the notes section it said:

            As of MODx 0.9.6, there is no API Function to check for Manager User Group Access. Use getUserDocGroups() to check for Manager Group Membership.

            That would lead me to believe that extmembercheck, and by extension my technique would not work for managers. Of course, maybe that’s old info, and if someone more knowledgeable could confirm (or discover by trial and error) that extmembercheck works with manager groups, then I would assume my technique would work as well.