MyBB Community Forums

Full Version: Replace "We currently..." on index
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
"We currently have X members registered."

With

"We currently have X members (usergroup) and X recruits (usergroup)..."

Yesterday i found something i think it can help me.
In index.php, find:
eval("\$boardstats = \"".$templates->get("index_boardstats")."\";"); 

Before that line, add:
$num_male = $db->fetch_field($db->simple_select("userfields", "COUNT(ufid) as count", "fid3='Male'"), "count");
$num_female = $db->fetch_field($db->simple_select("userfields", "COUNT(ufid) as count", "fid3='Female'"), "count");
// Other people
$stats_cache = $cache->read("stats");
$num_other = $stats_cache['numusers'] - $num_male - $num_female;

/* In the index_boardstats template, use the following variables:
    {$num_male}
    {$num_female}
    {$num_other}
*/ 

So i think the code must be something like this?
Quote:$num_guildmember = $db->fetch_field($db->simple_select("usergroup", "COUNT(gid) as count", "...?...'"), "count");
SELECT u.usergroup, count(s.sid) FROM mybb_sessions s LEFT JOIN mybb_users u ON (s.uid=u.uid) WHERE s.time>'$timesearch' AND s.uid != 0 GROUP BY u.usergroup;

Sample:
[Image: B9m8UJtlbKWU.png]

$groups = $cache->read('usergroups');
if u need all usergroups ordered by gid.