// ###################### 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 ####################
I added this hack and it's working fine, but now my latest new member isn't there (at the top). It says 'Welcome to our newest member, " but no name. How can I get that added back AND have this hack show at the bottom?
I added this hack and it's working fine, but now my latest new member isn't there (at the top). It says 'Welcome to our newest member, " but no name. How can I get that added back AND have this hack show at the bottom?
TLCanna, this error is fixed now and
if you want to have statistics of latest new member and statistics by this hack at the same time
instead of step 5 you have to do next:
why not
from 12oclock to 12oclock is 24hours do ur maths mate
ok so looks like we are back at school rnt we
from 11:59pm on the 20th to 11:59pm on the 21st
how many hours is that mate 24
how many hours are in a day 24 mate,so why doesnt it reset after 24hours at midnight
from midnight to midnight it should count