We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 14999
    • 0 Posts
    Do I see the same page the two pieces of code for two youtube videos

    if you watch the trailer is not registered, or if it belongs to the group x, y, watch the whole video

    example

    group if a <1 youtube video> else <youtube video2>

    thank you very much

    I think of a snippet, because I create chunks for each page
      • 3749
      • 24,544 Posts
      Something like this should do it (this assumes that you’re using MODX Revolution):

      <?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;

        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
        • 14999
        • 0 Posts
        brother, thanks for the answer - exactly should I make a call to a snippet

        I should call up the page and the snippet of code by inserting pieces of the video youtube

        Snippet called as value1 = youtube video code, value2 = 2 youtube video code
          • 37044
          • 68 Posts
          The following is a snippit by Lucas

          Snippit:
          <?php
          return $modx->user->isMember($group) ? $modx->getChunk($chunk) : '';

          Called by:
          [[!group-member-check? &group=`test_group` &chunk=`test_chunk`]]

          This code is similar to bobrays but only checks for one group. Might be of interest to someone else who finds this post. OP - http://forums.modx.com/index.php?topic=64148.0