Here's the updated one with datastore
index.php:
Find:
PHP Code:
// ### ALL DONE! SPIT OUT THE HTML AND LET'S GET OUTA HERE... ###
Above it, add:
PHP Code:
// Show 5 Newest Members //
$numbermembers = vb_number_format($userstats['numbermembers']);
$newestmembers = unserialize($datastore['newestmembers']);
foreach ($newestmembers as $two)
{
$counter++;
$newuserid = $two['userid'];
$newusername = $two['username'];
$newestbit .= "<a href=\"member.php?$session['sessionurl']u=$newuserid\">$newusername</a>";
if ($counter < 5)
{
$newestbit .= ", ";
}
}
// END Show 5 Newest Members //
Find: (in $specialtemplates)
PHP Code:
'eventcache',
'mailqueue'
Replace it with:
PHP Code:
'eventcache',
'mailqueue',
'newestmembers'
In the FORUMHOME TEMPLATE, find:
HTML Code:
<div><phrase 1="member.php?$session[sessionurl]u=$newuserid" 2="$newusername">$vbphrase[welcome_to_our_newest_member_x]</phrase></div>
Replace it with:
HTML Code:
<div>Welcome to our newest members, $newestbit </div>
Cron file:
(
newestmemberscron.php - put in /includes/cron)
PHP Code:
<?php
error_reporting(E_ALL & ~E_NOTICE);
if (!is_object($DB_site))
{
exit;
}
$newestmembers = $DB_site->query("
SELECT userid, username
FROM user
ORDER BY userid DESC
LIMIT 5
");
while($newestmemberss=$DB_site->fetch_array($newestmembers))
{ $counter++;
echo $counter;
$array[$counter] = $newestmemberss;
}
$fivenewestmembers = addslashes(serialize($array));
// Update DataStore
$check = $DB_site->query("
SELECT *
FROM datastore
WHERE title='newestmembers'
");
if ($DB_site->num_rows($check) == 0)
{
$insertdatastore = $DB_site->query("
INSERT INTO datastore
(title, data)
VALUES ('newestmembers', '$fivenewestmembers')
");
}
elseif ($DB_site->num_rows($check) != 0)
{
$updatedatastore = $DB_site->query("
UPDATE datastore
SET data='$fivenewestmembers'
WHERE title='newestmembers'
");
}
?>
Be sure to add that file to scheduled tasks, and set the run date as often as you'd like (probably an hour to a day, up to you).
.. first time having to use datastore, hopefully it's somewhat right.