We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 2935
    • 15 Posts
    My goal:
    Have a resources section on a clients website that has a list of articles that are marked as locked or unlocked based on the viewers Web user credentials. I can do the locked and unlocked thing with CSS class change.

    My progress:
    I have created a extender to Ditto that simply checks to see if the user is logged in and it works. Now I have been thrown a monkey wrench in that there is now more than one Web user type so my extender is now not enough.

    My problem:
    So I now need to check if the current user is a member of the Web group that the listed document is a member of it so that I can change the link class based on that. Does anyone have a suggestion on how I might acheive this? I am willing to start over if someone has a good suggestion. I am not finding an API function that finds the document groups that a page is a member off. Does one exist?

    -Brian
      • 18397
      • 3,250 Posts
      $modx->isMemberOfWebGroup( array( groups ) )
      


      This should let you find out if the currently logged in web user is a member of certain groups.
        • 6726
        • 7,075 Posts
        You could also give a look at the MemberCheck snippet, though I am not sure in your case specific code won’t be needed.

        Checks a logged in user’s group memberships and displays a chunk. Can be used multiple times on a page.

        Another way maybe to dynamically change class without writing PHP might be to use jQuery or mootools to change the classes, combined with MemberCheck it could do the trick... just a thought. If you’re proficient with PHP then Mark’s tip is just what you need !
          .: COO - Commerce Guys - Community Driven Innovation :.


          MODx est l'outil id