Register Members List Search Today's Posts Mark Forums Read

Reply
 
Thread Tools
  #1  
Old 28 Mar 2008, 22:09
lasto lasto is offline
 
Join Date: Jan 2002
Usergroups

Say i have 20 users in one usergroup - how can i call the amount of users in one specific usergroup so i can use that info on my index.php page.

I just want to grab the amount of users in one specific usergroup and display the info on main page so it looks something like this :

Admins : 7 (if that is the correct number)

Is this possible ......

--------------- Added 29 Mar 2008 at 17:23 ---------------

anyone know a way to pull this off - i know its not a big request

Last edited by lasto; 29 Mar 2008 at 17:23. Reason: Auto-Merged DoublePost
Reply With Quote
  #2  
Old 30 Mar 2008, 08:46
lasto lasto is offline
 
Join Date: Jan 2002
/me bumps this again
Reply With Quote
  #3  
Old 30 Mar 2008, 13:33
Opserty Opserty is offline
 
Join Date: Apr 2007
Check the Usergroup.php page in the AdminCP to see how vBulletin does it.

I'm not sure if the count is stored in the usergroup cache, (run a var_dump() of $vbulletin->usergroupcache to see if it is present).

If it doesn't then you best bet is to run a query to count the users in each usergroup and run this on the usergroup.php page or as a scheduled task to update a cache in the datastore. (You don't want to be querying the database on every page load when the data is going to be fairly static).

I'll see if I can give you some more information later, when I boot up my dev vBulletin, but this should give you an idea of what to do/look for.
Reply With Quote
  #4  
Old 30 Mar 2008, 18:37
lasto lasto is offline
 
Join Date: Jan 2002
cheers m8 as all i want the code for is to call on index.php to show how many users are in one particular usergroup.
Reply With Quote
  #5  
Old 30 Mar 2008, 19:15
Opserty Opserty is offline
 
Join Date: Apr 2007
Hmm by the looks of it, it isn't stored in the usergroup cache. Here is the query I pulled from the usergroup admin page:

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

You could change the WHERE clause to select just what you want.

Have a read of this as you'll probably just want to cache the results to save on queries and processing time. Cache System Explanation (datastore)
Reply With Quote
  #6  
Old 30 Mar 2008, 20:38
lasto lasto is offline
 
Join Date: Jan 2002
bit to much for me m8 how can i use the above info to show the stat i want without it sounding to over complicated

and thanks as well
Reply With Quote
  #7  
Old 31 Mar 2008, 07:19
Dismounted's Avatar
Dismounted Dismounted is offline
 
Join Date: Jun 2005
Real name: Hanson
The simple way, without using the cache (bad for load-heavy sites, and bad in general coding practise!):

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

__________________
Former vBulletin.org Staff Member

View My Modifications
29 Releases and Counting... Latest Modification: dmActivityStream - vBookie Integration (4.x)

Please do not PM me to ask for support - please use the relevant thread or forum.
Reply With Quote
  #8  
Old 31 Mar 2008, 17:00
lasto lasto is offline
 
Join Date: Jan 2002
i would add that code to my index.php is that correct : now what code would i need to call it into the board
Reply With Quote
  #9  
Old 31 Mar 2008, 18:17
Opserty Opserty is offline
 
Join Date: Apr 2007
Put that code in a FORUMHOME hook. Like forumhome_complete or something like that.

Then you just need to add $groupcount in your FORUMHOME template. Like:
Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

Reply With Quote
  #10  
Old 01 Apr 2008, 05:51
lasto lasto is offline
 
Join Date: Jan 2002
thanks m8 will try this tonight when get back from work.
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

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


New To Site? Need Help?

All times are GMT. The time now is 07:07.

Layout Options | Width: Wide Color: