Bug #1322
closedmembers management group filter no functional
100%
Description
Members Management filtering by group results in SQL error.
http://www.joomlapolis.com/component/option,com_joomlaboard/Itemid,38/func,view/id,110722/catid,106/
Updated by krileon about 15 years ago
- Status changed from New to Resolved
- Target version set to 1.8 B5
- % Done changed from 0 to 100
Resolved in B5 Repack.
Updated by krileon about 15 years ago
Quickfix
In: admin.groupjive.php
On: 815
From:
."\nWHERE b.id IN ($tmp)"
To:
."\nWHERE b.id IN (".($tmp?$tmp:0).")"
Updated by mcbsys about 15 years ago
I have B5 and am not getting a SQL error. However the user filter is not working if the user is not on the first page of results. The IN clause on line 815 only "sees" the users from the current page due to the LIMIT clause on line 800.
The problem is that the group filter is applied in the first query, and the returns are held in a string of user IDs, THEN the user filter is applied in a follow-up query using an IN statement on the user ID string. I thought about removing the LIMIT on the first query if a user filter is specified, but if there are 10,000 users that will be a huge IN clause.
Probably the two queries should be combined so selections by group and user happen in the same query, or a temp table should be used. For now I've made the following modification. It's still not perfect--if you filter by user and group, and the group has more members than fit on the page, you still may not find the user. But if you filter only by user, you can find the user even if the user is not on the first page.
I'm still new to PHP and I don't know what else may be going on in this module, so please check and test.
if (($and != '') && ($filter_type == 0)) { // user filter set and group filter not set - don't limit using IN $where = "\nWHERE 1=1 ".$and; } else { // user filter not set or group filter set - do limit using IN $where = "\nWHERE b.id IN (".($tmp?$tmp:0).") ".$and; } $query = "SELECT b.*, GROUP_CONCAT(g.id SEPARATOR ' ') AS groupids" ."\nFROM #__users AS b " ."\nLEFT JOIN #__gj_users AS u ON u.id_user = b.id" ."\nLEFT JOIN #__gj_groups AS g ON u.id_group = g.id" . $where ."\nGROUP BY b.id" ;
Updated by krileon about 15 years ago
- Target version changed from 1.8 B5 to 1.8 RC