We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 8872
    • 41 Posts
    Is there a way to display which group(s) logged in user belongs to? What I am trying to do is to hide one tv field for all users not in a particular group, so it is only visible for ie members.

    Tried with Login extra, but still banging my head with no solution. Please help.
      • 8872
      • 41 Posts
      Edit: thanks to BobRay, here is what I found on different thread (in my defense - it is difficult to search these forums):
      <?php
      /* InGroup snippet */
      $output = "";
      if ($modx->user->isMember('groupA')) {
          $output = $modx->getChunk('chunk1');
      } else if ($modx->user->isMember('GroupB')) {
          $output = $modx->getChunk('chunk2');
      } else {
          $output = $modx->getChunk('chunk3');
      }
      return $output;


      So I created that snippet and called it with
      [[!snippet]]
      and it is finally working. First forgot to put exclamation sign and I was thinking that I was going crazy :-0

      Thanks all, but I hope in future there would be an easier way to do it like
      [[group:eq=`Members`:then=`blahblah`:else=`blah`]]
        • 19369
        • 1,098 Posts
        MODX Revolution or Evolution?
        For Revolution I have found this, maybe is what you are looking for -> https://forums.modx.com/index.php?topic=52803.0