View Full Version : COUNT'ing usergroups...
Tryfwar
10-24-2003, 12:31 PM
Is there a way that i can have the total number of members belonging to a usergroup displayed in the header of each usergorup table listed in showgroups.php ?
I don't want to create a seperate SQL query for every instance of a usergroup, but would rather somehow have a variable placed in the WHERE clause which is then later defined.
Thanks
assassingod
10-24-2003, 02:03 PM
This is easy but since your forums is vB3, you'll have to wait til vB3 hacking is allowed
Tryfwar
10-24-2003, 02:40 PM
aarrrrrrrrrrrrgggg! lol
Could you e-mail me?
nick@mortalis.com I would greatly appreciate any help :D
Its really only MySQL syntax that i need, not template or anything vB specific.
Heres what i have atm for a custom script (based on showgroups.php) which produces this : http://www.mortalis.com/?mainDiv=/forums/rollcall.php
As you can see i have a created 3 queries to produce the totals for active, inactive & all, but have not been able to think up a count query for each of the classes.
NickPR
06-01-2004, 04:35 PM
bump ! been a while and vB3 is out now. Anyone able to help me still?
Xenon
06-01-2004, 05:04 PM
if you open showgroups.php
you'll find that line:
eval('$usergroups .= "' . fetch_template('showgroups_usergroup') . '";');
before that add:
$num_users = count($users);
now you just have to add $num_users into the showgroups_usergroup template, where you want to ahve it :)
NickPR
06-01-2004, 05:21 PM
it just returns 1. I have to admit that im using a very customised version of the showgroups.php and your probably not supposed to support me :p Its based on an older vb too now. So ill modify it so that it resembles the v3 more and try again.
Thanks for your reply :)
the Sandman
06-01-2004, 05:31 PM
This works great... except the count is incorrect for the "Moderators" category that includes everyone who is assigned to Moderate Forums regardless of usergroup. Any way to get that number correct? :)
Xenon
06-01-2004, 07:26 PM
for the moderators sections you have to use
$num_users = count($modcache);
it should work i'd say
the Sandman
06-01-2004, 07:28 PM
for the moderators sections you have to use
$num_users = count($modcache);
it should work i'd sayWhere?
Xenon
06-01-2004, 07:32 PM
before that:
exec_switch_bg();
eval('$moderatorbits .= "' . fetch_template('showgroups_usergroupbit') . '";');
the Sandman
06-01-2004, 07:40 PM
Thanks Xenon! I have it set up and working on the Admin Zone Forum Leaders Page (www.theadminzone.com/forums/showgroups.php?)!
Xenon
06-01-2004, 07:42 PM
you're welcome :)
(how comes i know so much names on your listing? ^^)
the Sandman
06-01-2004, 07:47 PM
you're welcome :)
(how comes i know so much names on your listing? ^^)I'm sure it's just coincidence... :)
reach_srinivas
11-18-2004, 10:03 AM
for moderator use SHOWGROUPS template
Zachery
11-18-2004, 11:45 AM
only several months late :)
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.