![]() |
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 [DATE]1206807835[/DATE] at [TIME]1206807835[/TIME] --------------- anyone know a way to pull this off - i know its not a big request :) |
/me bumps this again
|
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. |
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.
|
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:
PHP Code:
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) |
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 |
The simple way, without using the cache (bad for load-heavy sites, and bad in general coding practise!):
PHP Code:
|
i would add that code to my index.php is that correct : now what code would i need to call it into the board
|
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: Code:
Adminstrator: $groupcount |
thanks m8 will try this tonight when get back from work.
|
All times are GMT. The time now is 02:35 PM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|