Skip to content

Commit

Permalink
fixed group selection
Browse files Browse the repository at this point in the history
! fix for Issue #35, so groups with no users assgined can be selected
again
  • Loading branch information
marmotwb committed Aug 27, 2015
1 parent 87a1937 commit f235894
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions wbce/admin/groups/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,13 @@
);

// Get existing groups from database (and get users in that group)
$query = "SELECT g.group_id, CONCAT(name,' (',COUNT(*),')') AS name
FROM ".TABLE_PREFIX."groups AS g, ".TABLE_PREFIX."users AS u
WHERE g.group_id != '1'
AND (g.group_id = u.group_id
OR FIND_IN_SET(g.group_id, u.groups_id) > '0')
GROUP BY g.group_id";
$query = "SELECT g.group_id, CONCAT(name,' (',COUNT(u.group_id),')') AS name
FROM ".TABLE_PREFIX."groups AS g LEFT JOIN ".TABLE_PREFIX."users AS u
ON (g.group_id = u.group_id
OR FIND_IN_SET(g.group_id, u.groups_id) > '0')
WHERE g.group_id != '1'
GROUP BY g.group_id
ORDER BY g.name";

$results = $database->query($query);
if($database->is_error()) {
Expand Down

0 comments on commit f235894

Please sign in to comment.