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"
;