• change the contents of a page based on a group of users#

  • juke80 Reply #1, 10 months ago

    Reply
    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


  • BobRay Reply #2, 10 months ago

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



  • juke80 Reply #3, 10 months ago

    Reply
    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


  • megasteve4 Reply #4, 3 months, 3 weeks ago

    Reply
    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