Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > General > Member Archives
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
Details »»

Version: , by leadZERO (Guest)
Developer Last Online: Jan 1970 Show Printable Version Email this Page

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

~ Replace:
echo "<li>$usergroup[title]".

~ With:
//CHANGE LINE
//WAS - echo "<li>$usergroup[title]".
echo "<li>$usergroup[title] - <i>$mems Members</i>".

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #2  
Old 02-25-2001, 01:42 PM
Guest
 
Posts: n/a
Default

Nice one and valuable. Thanks for sharing it with us. I'll try it on my test board this evening.
Reply With Quote
  #3  
Old 02-25-2001, 02:06 PM
Guest
 
Posts: n/a
Default

May I suggest changing

Code:
//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
Will be a wee bit faster for ya..
Reply With Quote
  #4  
Old 02-25-2001, 02:15 PM
Guest
 
Posts: n/a
Default

Hmmm...

Are you sure thats right? I tried it and now it doesn't show the number...
Reply With Quote
  #5  
Old 02-25-2001, 02:35 PM
Guest
 
Posts: n/a
Default

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";
Reply With Quote
  #6  
Old 03-01-2001, 10:18 AM
Guest
 
Posts: n/a
Default

I'm getting this error when I change it into that freddie:

: Using scalar variable $usergroup as an array or object in .. usergroup.php
Reply With Quote
  #7  
Old 03-01-2001, 10:37 AM
Guest
 
Posts: n/a
Default

fixed it... I forgot something
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 02:53 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04277 seconds
  • Memory Usage 2,247KB
  • Queries Executed 22 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (3)bbcode_code
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (7)post_thanks_box
  • (7)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (7)post_thanks_postbit_info
  • (6)postbit
  • (7)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete