Uutiset:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu
Advertisement:

Can someone create me a simple script for SMF 1.x?

Aloittaja Biology Forums, tammikuu 16, 2014, 09:42:14 IP

« edellinen - seuraava »

Biology Forums

On the main index, I would like to add something like:

So far today, # guests joined our community.

Where # is the number of members that have registered today. I looked at stats.php to get inspiration on how to setup the code, and I found this, though I'm lost in terms of how I could simplify it and use it to get today's registrants.

function getDailyStats($condition)
{
global $context, $db_prefix;

// Activity by day.
$days_result = db_query("
SELECT YEAR(date) AS stats_year, MONTH(date) AS stats_month, DAYOFMONTH(date) AS stats_day, topics, posts, registers, mostOn, hits
FROM {$db_prefix}log_activity
WHERE $condition
ORDER BY stats_day ASC", __FILE__, __LINE__);
while ($row_days = mysql_fetch_assoc($days_result))
$context['monthly'][$row_days['stats_year'] . sprintf('%02d', $row_days['stats_month'])]['days'][] = array(
'day' => sprintf('%02d', $row_days['stats_day']),
'month' => sprintf('%02d', $row_days['stats_month']),
'year' => $row_days['stats_year'],
'new_topics' => $row_days['topics'],
'new_posts' => $row_days['posts'],
'new_members' => $row_days['registers'],
'most_members_online' => $row_days['mostOn'],
'hits' => $row_days['hits']
);
mysql_free_result($days_result);
}

Advertisement: