We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 8168
    • 1,118 Posts
    Hi, I am using pdoTools pdoUser to return users from MODx using the code below:

    [[!pdoUsers?
         &groups=`Partners`
         &xtpl=`partnerTpl`
         &sortby=`id`
         &sortdir=`asc`
        &limit=`3`
        &where=`{"modUserProfile.extended:LIKE":"%\"customField1\":\"Value\"%"}`
        &showLog=`1`
    ]]
    


    This works well, My questions is... Is it possible to pass more than one customvalue to the Where element of the code? e.g. to search more than one of the custom fields for the searched value. e.g.

    &where=`{"modUserProfile.extended:LIKE":"%\"customField1,customField2\":\"Value\"%"}`
      • 3749
      • 24,544 Posts
      Yes, but the where statement will need to be much more complex because you want to use OR for the criteria. It would be something like this (untested):


      &where=`[
          {"modUserProfile.extended:LIKE:":"\"%\"customfield1\":\"London\"%"},
          {"OR:modUserProfile.extended:LIKE:":"\"%\"customfield1\":\"Essex\"%"}
      ]`
      


      The rest of the lines should look like the second one. All should end with a comma except the last one.




      [ed. note: BobRay last edited this post 8 years, 6 months ago.]
        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
        • 8168
        • 1,118 Posts
        Thanks Bob - typo in your code - but the approach allowed me to work it out wink

        Working code as below:

        &where=`[
            {"modUserProfile.extended:LIKE":"%\"customfield01\":\"Value\"%"},
            {"OR:modUserProfile.extended:LIKE":"%\"customfield02\":\"Value\"%"},
            {"OR:modUserProfile.extended:LIKE":"%\"customfield03\":\"Value\"%"}
        ]`
        



        Thanks wink

        Now to work out how to get this to work via a search function rather than me defining the customfields and values!!!