We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 37686
    • 94 Posts
    I've got an icon that defines a country. When this icon is clicked on, i would like to show only the users based on this city(for example New York)

    How can i arange/fix this? [ed. note: stevebravo last edited this post 13 years, 10 months ago.]
      • 37686
      • 94 Posts
      can somebody help me plz?
        • 37686
        • 94 Posts
        can somebody help me plz?
          • 28042 ☆ A M B ☆
          • 24,524 Posts
          Well, for one thing New York is not a country. That makes it a little unclear exactly what it is you are trying to do.
            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
            • 37686
            • 94 Posts
            Quote from: sottwell at Dec 16, 2012, 11:14 AM
            Well, for one thing New York is not a country. That makes it a little unclear exactly what it is you are trying to do.

            i meant city! laugh

              • 28042 ☆ A M B ☆
              • 24,524 Posts
              The "Peoples" snippet is what you need. It has a "where" property (not mentioned in the rtfm, but is in the snippet code) that you should be able to use to specify the city (city = "New York"). How you pass the selected city to the snippet property is another matter. There are several ways to handle that; I'd be inclined to use AJAX and have the Peoples snippet be the AJAX request processor.
                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
                • 42146
                • 73 Posts
                Quote from: sottwell at Dec 17, 2012, 03:21 AM
                The "Peoples" snippet is what you need. It has a "where" property (not mentioned in the rtfm, but is in the snippet code) that you should be able to use to specify the city (city = "New York"). How you pass the selected city to the snippet property is another matter. There are several ways to handle that; I'd be inclined to use AJAX and have the Peoples snippet be the AJAX request processor.

                thanks for the tip about the non documented "where" property, i think i'll have to give that a try. in my own wanting to search user city... and other extended user profile data.

                  • 42146
                  • 73 Posts
                  i looked around. but how do i use the "where" property?
                    • 28042 ☆ A M B ☆
                    • 24,524 Posts
                    I would presume something like &where=`'array(city'=>'Los Angles')` or &where=`{'city':'Los Angles'}`

                    It can be an array or a JSON string.

                    http://rtfm.modx.com/display/xPDO20/xPDOQuery.where
                    http://rtfm.modx.com/display/xPDO20/fromJSON

                    from the snippet.peoples.php file line 40
                    $where = $modx->getOption('where',$scriptProperties,'');


                    Then line 70
                    if (!empty($where)) {
                        $where = is_array($where) ? $where : $modx->fromJSON($where);
                        $c->where($where);
                    }
                      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