Filtering by Select Attribute?
Permalink 1 user found helpful
I've created a bunch of User Attributes, and I'm trying to make a block to display groups of users filtered by some of these attributes.
Everything seems peachy until I try to filter based on select type attributes.
example...
What is the correct method to filter the results?
Everything seems peachy until I try to filter based on select type attributes.
example...
Loader::model('user_list'); $userList = new UserList(); $userList->sortBy('last_name', 'asc'); $userList->filterByGroup('Members'); // Works $userList->filterByFirstName('John'); // Doesn't Work $userList->filterByRegion('Los Angeles'); // Doesn't Work $userList->filterByRegion(array('Los Angeles')); // Doesn't Work $userList->filterByRegion(10);
What is the correct method to filter the results?
WOW! Thank you so much!
I searched through the code for several hours, and was at a dead end. I actually started extending the model and doing raw sql queries.
You just saved me a lot of time. :-)
I searched through the code for several hours, and was at a dead end. I actually started extending the model and doing raw sql queries.
You just saved me a lot of time. :-)
i think you all may be pointing me in the right direction. I am very novice to development, but working with C5 to build a very simple dating site, and execute advanced search via user attributes.
I need to make a block to place on the site to execute the query and return the avatar results.
Any help to get me over the hump.
Thanks in advance
I need to make a block to place on the site to execute the query and return the avatar results.
Any help to get me over the hump.
Thanks in advance
does it really need to be a block? you could just use a single page, or a page type too.
Yeah, it sounds like you would want to make a single page for doing advanced searches. That way you may have an easier time with rendering your results the way you want them to appear.
Matching text in this kind of field can't just be using the normal equality operator = so I could do it using 'like' as follows:
I think this should be fixed, so I'll report it.
** Edit:
I'm wrong, let me correct. All values are stored in the same field, with a \n (new line) separator.
So, when searching for one of the values, it won't match (using the = operator) as the search matches all the field's content. Thus, you have to use the 'like' operator instead.