this is a translation from a post of merlin
http://www.my-vb.de/board/hacks-addo....html#post1766
at hook init_start:
PHP Code:
$datastore_fetch[] = "'userstats'";
hook: global_start
PHP Code:
// Themen & Beitr?ge
$counters = $db->query_first("SELECT SUM(threadcount) AS threads, SUM(replycount) AS replies FROM " . TABLE_PREFIX . "forum");
$totalposts = vb_number_format($counters['replies']);
$totalthreads = vb_number_format($counters['threads']);
// Neuester Benutzer
$numbermembers = vb_number_format($vbulletin->userstats['numbermembers'];
$newusername =& $vbulletin->userstats['newusername'];
$newuserid =& $vbulletin->userstats['newuserid'];
// User/G?ste Online
$datecut = TIMENOW - $vbulletin->options['cookietimeout'];
$headerguests = 0;
$headerusersq = $db->query_read("SELECT userid, lastactivity FROM " . TABLE_PREFIX . "session WHERE lastactivity > $datecut");
$headeruserinfos = array();
while ($headeruser = $db->fetch_array($headerusersq))
{
if (!headeruser['userid'])
{
$headerguests++;
}
else if (empty($headeruserinfos["$headeruser[userid]"]) OR ($headeruserinfos["$headeruser[userid]"]['lastactivity'] < $headeruser['lastactivity']))
{
$headeruserinfos["$headeruser[userid]"] = $headeruser;
}
}
if (!$vbulletin->userinfo['userid'] AND $headerguests == 0)
{
$headerguests++;
}
$headerguests = count($headeruserinfos);
$totalonline=$headerguests+$headerusers;
unset($headeruserinfos);
$db->free($headerusersq);
then insert the variables into the headertemplate