We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!

Answered array question

    • 43592
    • 97 Posts
    Hi Forum,

    Ive a maybe simple (but for me not) array question:

    I try to show the groupmembers by a snippet which gets the groups out of a TV:

    [[!grouplist? &group=`[[*Gruppe]]`]] (Inpupt fe: 2,3,4


    I query it but it always only shows up the first group (2):
    'UserGroupMembers.user_group:IN' => array($group)

    So my assumption is that I represent the array wrong to the query, because when I do

    'UserGroupMembers.user_group:IN' => array(2,3,4) it works!

    Any ideas?

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

    • discuss.answer
      • 18373 ☆ A M B ☆
      • 3,141 Posts
      Mark Hamstra Reply #2, 9 years ago
      Try

      'UserGroupMembers.user_group:IN' => explode(',', $group)
      


      That will turn your string "2,3,4" into an array with items 2, 3 and 4.
        Mark Hamstra • Developer spending his days working on Premium Extras and a MODX Site Dashboard with the ability to remotely upgrade MODX and extras to make the MODX world a little better.

        Tweet me @mark_hamstra, check my infrequent blog at markhamstra.com, my slightly more frequent ramblings at MODX.today or see code at Github.
        • 43592
        • 97 Posts
        Thanks! That worked!