We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 49659
    • 86 Posts
    I am trying to pass a user id to a snippet using the [[!+modx.user.id]] placeholder. The following works, when the user id is a literal number:
    [[PeopleGroups? &user=`11` &limit=`0`]]
    


    However, when I use a placeholder for the user id, as in:

    [[PeopleGroups? &user=`[[!+modx.user.id]]` &limit=`0`]]
    


    ...the value passed to the snippet is the literal text of the placeholder and not the placeholder value. In other words, instead of seeing the number '11' for user id 11, the snippet sees '[[!+modx.user.id]]'.

    What am I missing here?

    Thanks!

    This question has been answered by Bruno17. See the first response.

      • 28042 ☆ A M B ☆
      • 24,524 Posts
      It works when I try it as a property value. What does your snippet code look like?
        Studying MODX in the desert - http://sottwell.com
        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
        Join the Slack Community - http://modx.org
        • 28042 ☆ A M B ☆
        • 24,524 Posts
        Using your exact snippet call, and my snippet code simply returns the property value
        <?php
        $user = $modx->getOption('user', $scriptProperties, 0);
        
        return $user;
          Studying MODX in the desert - http://sottwell.com
          Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
          Join the Slack Community - http://modx.org
        • discuss.answer
          • 4172
          • 5,888 Posts
          I think you need to call your snippet uncached

          [[!PeopleGroups? &user=`[[!+modx.user.id]]` &limit=`0`]]
            -------------------------------

            you can buy me a beer, if you like MIGX

            http://webcmsolutions.de/migx.html

            Thanks!
            • 49659
            • 86 Posts
            That did it. Thank you!