The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
How to display a count for the number of members in a certain usergroup
How would I display something along the lines of, "Now home to ### premium members," in a place like the noticebit or somewhere LIKE that in order to catch the eye of non-premium members? Any thoughts or suggestions would be greatly appreciated!
|
#2
|
|||
|
|||
If the premium members belong to a certain usergroup, you could do a query in a plugin and get the count, then use the value in a template. Also, unless you really want it to update as soon as someone else joins, you could put it in a scheduled task and write it to the datastore, so that it won't add a query to each page load. So maybe something like:
Code:
$premium_gid = X; $result = $vbulletin->db->query_first_slave("SELECT COUNT(*) AS members FROM " . TABLE_PREFIX . "user WHERE usergroupid=$premium_gid"); if ($result) { build_datastore('premium_members', $result['members']); } Maybe using hook cron_script_cleanup_hourly. Then in another plugin on init_startup: Code:
$new_datastore_fetch[] = 'premium_members'; Then manually run the Hourly Cleanup scheduled task to store a value, then you can use {vb:raw vbulletin->premium_members} in whatever template you want. |
Thread Tools | |
Display Modes | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|