PDA

View Full Version : Display the number of members of a group


tokads3
02-11-2013, 08:04 AM
Hi all,

Here I would like to show in the stats footer of the forum, the number of members of a specific group that we created (total core members + additional members)

A bit like this example

Threads: 1234, Posts: 123,456 Members: 12345
Welcome to our newest member, XXXX
Today Posts: 123
New Users Today: 12
Association members: 1234



How? Thank you in advance, sorry for my english

tokads3
02-12-2013, 10:36 AM
Nobody can help me?? :(

tokads3
02-14-2013, 05:39 AM
?????

LifesGreatestGift
02-14-2013, 04:47 PM
New plugin

Count primary / secondary users of group

hook location: forumhome_complete

$groupid = 6; // Count admin users

$group_primary = $vbulletin->db->query_first("
SELECT COUNT(user.userid) AS count
FROM " . TABLE_PREFIX . "user AS user
WHERE user.usergroupid = " . $groupid . "
");
$group_secondary = $vbulletin->db->query_first("
SELECT COUNT(user.userid) AS count
FROM " . TABLE_PREFIX . "user AS user
WHERE user.membergroupids = " . $groupid . "
");

$primary = $group_primary['count'];
$secondary = $group_secondary['count'];
$total = vb_number_format($primary + $secondary);

vB_Template::preRegister('FORUMHOME',array('g_coun t' => $total));

then in FORUMHOME template you can do

Association members: {vb:raw g_count}

Be sure to change the '6' in $groupid to the group id you are trying to count.

tokads3
02-16-2013, 06:09 AM
Thank you very much, it's good. :)

LifesGreatestGift
02-16-2013, 11:40 AM
https://vborg.vbsupport.ru/images/cstyle/blue/buttons/like.gif

TRBozo
08-08-2013, 09:04 AM
New plugin

Count primary / secondary users of group

hook location: forumhome_complete

$groupid = 6; // Count admin users

$group_primary = $vbulletin->db->query_first("
SELECT COUNT(user.userid) AS count
FROM " . TABLE_PREFIX . "user AS user
WHERE user.usergroupid = " . $groupid . "
");
$group_secondary = $vbulletin->db->query_first("
SELECT COUNT(user.userid) AS count
FROM " . TABLE_PREFIX . "user AS user
WHERE user.membergroupids = " . $groupid . "
");

$primary = $group_primary['count'];
$secondary = $group_secondary['count'];
$total = vb_number_format($primary + $secondary);

vB_Template::preRegister('FORUMHOME',array('g_coun t' => $total));

then in FORUMHOME template you can do

Association members: {vb:raw g_count}

Be sure to change the '6' in $groupid to the group id you are trying to count.



thank you, I'm looking for it for days..