MyBB Community Forums

Full Version: Count Group Members
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I'm currently in need of 4 variables. I want to display the total amount of members of individual groups on the AdminCP index page.
Like this on the group management page: http://i.gyazo.com/fd2880d65e7b3783682ca797f0c8b955.png

It should display the total amount of members. (Primary group and secondary group counted)

Need these variables:
$total_1 = TOTAL AMOUNT OF GROUP ID 12
$total_2 = TOTAL AMOUNT OF GROUP ID 28
$total_3 = TOTAL AMOUNT OF GROUP ID 36
$total_4 = TOTAL AMOUNT OF GROUP ID 12 + 28 + 36

Sorry for grammar, didn't sleep since 31 hours.
You would need a plugin, but you would just have to do a simple query that does a select count() on the groups
$count = $db->fetch_field( $db->query( "SELECT COUNT(*) as numberofmembers FROM ".TABLE_PREFIX."users WHERE usergroup = {Usergroup} ), 'numberofmembers' );
(2015-04-04, 07:21 AM)Cedric Wrote: [ -> ]$count = $db->fetch_field( $db->query( "SELECT COUNT(*) as numberofmembers FROM ".TABLE_PREFIX."users WHERE usergroup = {Usergroup} ), 'numberofmembers' );

The thread was posted on "06-12-2014, 07:47 AM"
(2015-04-04, 07:26 AM)PhantomD Wrote: [ -> ]
(2015-04-04, 07:21 AM)Cedric Wrote: [ -> ]$count = $db->fetch_field( $db->query( "SELECT COUNT(*) as numberofmembers FROM ".TABLE_PREFIX."users WHERE usergroup = {Usergroup} ), 'numberofmembers' );

The thread was posted on "06-12-2014, 07:47 AM"

And now it's solved. Cool