1283 Posts
Bucklash
6 years ago
0
Topic

Hi folks

When it works it works and when it doesn't, well, you know how you feel....

In case you are getting tripped up by SEARCH QUERY FIELD this might help.

EXAMPLE:

List of USERS.

Filter these users based on USERGROUP....

- Create Search Join Field.

JOIN 1 Table/Query

LEFT/INNER/RIGHT |  #__user_usergroup_map | user_id ... 
 #__users | id

JOIN 2 Table/Query

LEFT/INNER/RIGHT | #__usergroups | id ...
#__user_usergroup_map| group_id

If you choose 'Query' instead of 'Table' then I think it uses an alias from the initial query i.e.

SELECT t0.id AS pid,t0.pk AS pk,t0.pkb AS pkb,t0.parent_id AS parent,t0.author_id AS author,t0.cck AS cck,t0.storage_location AS loc,tt.id AS type_id,tt.alias AS type_alias
FROM `#__cck_core` AS t0
LEFT JOIN `#__users` AS t3 ON t3.id = t0.pk
INNER JOIN `#__user_usergroup_map` AS t1 ON t1.user_id = t3.id
INNER JOIN `#__usergroups` AS t2 ON t2.id = t1.group_id
LEFT JOIN `#__cck_core_types` AS tt ON tt.name = t0.cck
WHERE t0.cck = 'user' <br> AND t2.id = 12
ORDER BY t3.lastvisitDate DESC
LIMIT 25

THEN

You can add fields on the USERGROUP table to search with i.e.

I used:

Field: SELECT DYNAMIC

Query: SELECT usg.title AS text, usg.id AS value FROM #__usergroups AS usg ORDER BY usg.lft

Storage: Standard | Free | id | #__usergroups

Get a Book for SEBLOD