MyBB Community Forums

Full Version: [F] ACP - group # of users when using additional groups bug [C-StefanT]
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I've noticed that in the administration control panel when viewing groups, the # of users in each group is wrong because it wasn't counting any users that had the groups listed as additional groups. I think the problem is in the admin\modules\users\groups.php file in the query:

default:
	$query = $db->query("
		SELECT g.gid, COUNT(u.uid) AS users
		FROM ".TABLE_PREFIX."users u
		LEFT JOIN ".TABLE_PREFIX."usergroups g ON (CONCAT(',', u.additionalgroups, ',') LIKE CONCAT('%,', g.gid, ',%'))
		WHERE g.gid != '0' AND g.gid != NULL GROUP BY g.gid

the !=NULL should be is not null. The query is also in the sqllite case statement I'm guessing it should be changed in that also but I'm using mysql so I couldn't test that one.

Thanks
!= means IS NOT so I guess that's not the problem
(2009-07-24, 03:49 PM)Pirata Nervo Wrote: [ -> ]!= means IS NOT so I guess that's not the problem

You're right, however when comparing to NULL in SQL it fails the query. so you have to use IS/IS NOT when comparing to NULL in SQL
Yeah you're right I guess :p
Thank you for your bug report.

This bug has been fixed in our internal code repository. Please note that the problem will not be fixed here until these forums are updated.

With regards,
MyBB Group
Awesome...I reported this bug a while ago but I think it was disregarded. Thanks for finding a fix, posting it and to Ryan for adding it to maintenance. I needed this will all my custom groups.