We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 37523
    • 141 Posts
    I noticed that in the roadmap for Peoples there is going to be future support for &where. It appears that in the current version there is support.

    I am trying to create a list of users excluding 2 particular ones

    The below works:
    [[!Peoples? &limit=`0` &tpl=`userNameListTPL` &where=`{"User.id:!=":88`]]

    and hides the particular user with an id of 88

    Going by an &where sample from getResources the below does not work:
    [[!Peoples? &limit=`0` &tpl=`userNameListTPL` &where=`{"User.id:!=":88, "OR:User.id:!=":5}`]]

    or
    [[!Peoples? &limit=`0` &tpl=`userNameListTPL` &where=`{"User.id:!=":[88,5]}`]]

    This will display the users with id 88 or 5

    Am I doing something incorrectly or this because the &where function in Peoples is not fully working yet.

    Are there any alternatives for me to achieve a similar outcome?
      Glyn Szasz
      Sydney, Australia

      Happy to help (when can) and happy to learn

      If you are a Sydney based MODX developer would love to hear from you. Please contact me.
      • 3749
      • 24,544 Posts
      I haven't looked, but I'm 99% sure Peoples just passes the &where to xPDO.

      Your logic in the OR condition is the problem. Every ID is either not 88 or not 5 (i.e. 5 is not 88 and 88 is not 5). I think you want NOT IN:
      $where=`{"User.id:NOT IN":[88,5]}`
        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
        • 37523
        • 141 Posts
        Many thanks Bob, that worked perfectly.
          Glyn Szasz
          Sydney, Australia

          Happy to help (when can) and happy to learn

          If you are a Sydney based MODX developer would love to hear from you. Please contact me.
          • 3749
          • 24,544 Posts
          Glad I could help. Thanks for reporting back. smiley
            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