// ###################### Start saveuserstats #######################
// Save user count & newest user into template
function build_user_statistics()
{
global $vboptions, $DB_site;
// get total members
$members = $DB_site->query_first("SELECT COUNT(*) AS users, MAX(userid) AS max FROM " . TABLE_PREFIX . "user");
// get newest member
$newuser = $DB_site->query_first("SELECT userid, username FROM " . TABLE_PREFIX . "user WHERE userid = $members[max]");
// make a little array with the data
$values = array(
'numbermembers' => $members['users'],
'newusername' => $newuser['username'],
'newuserid' => $newuser['userid']
);
// update the special template
build_datastore('userstats', serialize($values));
}
And replace by this code:
PHP Code:
// ###################### Start saveuserstats #######################
// Save user count & newest user into template
// Function is modified by Oleg Subel for STATISTICS AND LIST OF NEW REGISTERED MEMBERS 24h
function build_user_statistics()
{
global $vboptions, $DB_site;
// get total members
$members = $DB_site->query_first("SELECT COUNT(*) AS users, MAX(userid) AS max FROM " . TABLE_PREFIX . "user");
// get last newest members 24h
$cattime24 = TIMENOW - 24 * 60 * 60;
$newusers = $DB_site->query("SELECT joindate, userid, username FROM " . TABLE_PREFIX . "user WHERE joindate > $cattime24");
// $newuser = $DB_site->query_first("SELECT userid, username FROM " . TABLE_PREFIX . "user WHERE userid = $members[max]");
if (empty($newusers24[0]))
{
$lastnewuser = $DB_site->query_first("SELECT userid, username FROM " . TABLE_PREFIX . "user WHERE userid = $members[max]");
}
// make a little array with the data
$values = array(
'numbermembers' => $members['users'],
'newusername' => ( (empty($newusers24[0])) ? $lastnewuser['username'] : $newusers24[0]['name'] ),
'newuserid' => ( (empty($newusers24[0])) ? $lastnewuser['userid'] : $newusers24[0]['id'] ),
'lastregusers24h' => $newusers24
);
// update the special template
build_datastore('userstats', serialize($values));
}
Step 2
In index.php
Find:
PHP Code:
// get total members and newest member from template
$userstats = unserialize($datastore['userstats']);
$numbermembers = vb_number_format($userstats['numbermembers']);
$newusername = $userstats['newusername'];
$newuserid = $userstats['newuserid'];
And insert this code below:
PHP Code:
// ### STATISTICS AND LIST OF NEW REGISTERED MEMBERS 24h by Oleg Subel ####################