Version: , by leadZERO (Guest)
Developer Last Online: Jan 1970
Version: Unknown
Rating:
Released: 02-25-2001
Last Update: Never
Installs: 0
No support by the author.
Someone asked for this hack, it was a simple thing so I took 10 minutes and coded it.
This will show the number of users in each group in the User Groups and Permissions -> Modify
#### Changes to "admin/usergroup.php" ####
~ Search for:
while ($usergroup=$DB_site->fetch_array($usergroups)) {
~ Add after:
//LEADZERO -- number of users per group hack
//ADD BLOCK
$q_id = $DB_site->query("SELECT username FROM user WHERE usergroupid=$usergroup[usergroupid]");
$mems = $DB_site->num_rows( $q_id );
//END ADD BLOCK
//LEADZERO -- number of users per group hack
//ADD BLOCK
$q_id = $DB_site->query("SELECT username FROM user WHERE usergroupid=$usergroup[usergroupid]");
$mems = $DB_site->num_rows( $q_id );
//END ADD BLOCK
to
Code:
//LEADZERO -- number of users per group hack
//ADD BLOCK
$q_id = $DB_site->query_first("SELECT COUNT(*) as count FROM user WHERE usergroupid=$usergroup[usergroupid]");
$mems = $q_id[count];
//END ADD BLOCK
Looks right to my naked eye but if ya want you can replace your whole block of code in the modify section of usergroup.php with the following code. It is what will be in beta3/release (whichever it is)
Code:
$usergroups=$DB_site->query("SELECT usergroup.usergroupid, usergroup.title, COUNT(user.userid) as count
FROM usergroup
LEFT JOIN user ON (user.usergroupid = usergroup.usergroupid)
GROUP BY usergroup.usergroupid
ORDER BY usergroup.title");
echo "<table align=\"center\" bgcolor=\"black\" border=0 cellpadding=0 cellspacing=0><tr><td>";
echo "<table border=0 cellspacing=1 cellpadding=4><tr bgcolor=\"#3F3849\"><td align=\"center\" colspan=4><FONT color=\"#BCB6CD\"><b>Usergroups</b></FONT></td></tr>\n";
echo "<tr bgcolor=\"#51485F\"><td nowrap align=\"center\" width=\"100%\"><FONT color=\"#BCB6CD\">Usergroup</font></td><td align=\"center\" nowrap><FONT color=\"#BCB6CD\"># of Users</font></td><td align=\"center\" nowrap><FONT color=\"#BCB6CD\">Edit</font></td><td nowrap align=\"center\"><FONT color=\"#BCB6CD\">List Users</font></td></tr>\n";
while ($usergroup=$DB_site->fetch_array($usergroups)) {
echo "<tr bgcolor=\"#CCCCCC\"><td width=\"100%\">$usergroup[title]</td><td nowrap>$usergroup[count]</td><td nowrap>".
makelinkcode("edit","usergroup.php?s=$session[sessionhash]&action=edit&usergroupid=$usergroup[usergroupid]").
iif($usergroup[usergroupid]>6,makelinkcode("remove","usergroup.php?s=$session[sessionhash]&action=remove&usergroupid=$usergroup[usergroupid]"),"")."</td><td nowrap>".
makelinkcode("list all users","user.php?s=$session[sessionhash]&action=find&usergroupid=$usergroup[usergroupid]").
"</td></tr>\n";
}
echo "</table></td></tr></table>\n";