Questa è la MOD che visualizza TUTTI gli utenti che si sono collegati al Vostro forum nella giornata di oggi. Inoltre aggiunge una nuova casella nelle statistiche giornaliere dove verrà inserito il numero di utenti totali collegati in qual dato giorno:
Innanzitutto bisogna aggiungere una colonna alla tabella MYSQL "log_activity". Potete farlo da PHPMyAdmin, con la seguente linea di comando :
ALTER TABLE {$db_prefix}log_activity ADD allOn smallint(5) unsigned NOT NULL default '0';
(Sostituendo "{$db_prefix}" con il suffisso del vostro DB (normalmente "smf_")
Dopidichè le seguenti modifiche :
BoardIndex.php
<Search>
// Load the users online right now.
</Search>
<Add Before>
// Load the users online today.
$midnight = ((date("U") - (date("H") * 3600)) - (date("i") * 60));
// Load the users online for the past 24 hours.
$result = db_query("
SELECT
mem.ID_MEMBER, mem.realName, mem.memberName, mem.ID_GROUP, mem.showOnline, mem.avatar, mem.lastLogin, mem.posts,
mg.onlineColor
FROM {$db_prefix}members AS mem
LEFT JOIN {$db_prefix}membergroups AS mg ON (mg.ID_GROUP = mem.ID_GROUP OR (mem.ID_GROUP = 0 AND mg.ID_GROUP = mem.ID_POST_GROUP))
WHERE mem.lastLogin >= '$midnight'
ORDER BY mem.realName", __FILE__, __LINE__);
$today['users'] = array();
$today['num_users'] = 0;
$link = '';
while ($tmp = mysql_fetch_assoc($result))
{
$link .= '<a href="' . $scripturl . '?action=profile;u=' . $tmp['ID_MEMBER'] . '" style="color: ' . $tmp['onlineColor'] . ';">' . $tmp['realName'] . '</a>, ';
$today['num_users']++;
}
mysql_free_result($result);
$context['user_today'] = $link;
$context['num_users_today'] = $today['num_users'];
trackStats(array('allOn' => $context['num_users_today']));
</Add Before>
BoardIndex.template.php
<Search>
// If they are logged in, but SP1 style information is off... show a personal message bar.
</Search>
<Add Before>
// "Users online Today"
echo '
<tr>
<td class="catbg" colspan="2">', $txt['158bis'], ' ( ', $context['num_users_today'], ' ', $context['num_users_today'] == 1 ? $txt['user'] : $txt['users'], ' )</td>
</tr><tr>
<td class="windowbg" width="20" valign="middle" align="center"><img src="', $settings['images_url'], '/icons/online.gif" alt="', $txt['158bis'], '" border="0" /></td>
<td class="windowbg2" width="100%"><span class="smalltext">', $context['user_today'], '</span></td></tr>';
</Add Before>
Modifications.english.php
<Search>
// Version: 1.0 RC1; Modifications
</Search>
<Add After>
$txt['158bis'] = 'OnLine Users Today';
$txt['smf_stats_14bis'] = 'OnLine Day Users';
</Add After>
Modifications.italian.php
<Search>
// Version: 1.0 RC1; Modifications
</Search>
<Add After>
$txt['158bis'] = 'Utenti OnLine nella Giornata di Oggi';
$txt['smf_stats_14bis'] = 'Presenze OnLine Giornaliere';
</Add After>
Stats.template.php
<Search>
<td>', $txt['smf_stats_14'], '</td>';
</Search>
<Replace>
<td>', $txt['smf_stats_14'], '</td>
<td>', $txt['smf_stats_14bis'], '</td>
</Replace>
<Search>
<th align="center">', $month['most_members_online'], '</th>';
</Search>
<Replace>
<th align="center">', $month['most_members_online'], '</th>
<th align="center">', $month['all_members_online'], '</th>';
</Replace>
<Search>
<td align="center">', $day['most_members_online'], '</td>';
</Search>
<Replace>
<td align="center">', $day['most_members_online'], '</td>
<td align="center">', $day['all_members_online'], '</td>';
</Replace>
Stats.php
<Search>
MAX(mostOn) AS mostOn
</Search>
<Replace>
MAX(mostOn) AS mostOn, MAX(allOn) AS allOn
</Replace>
<Search>
'most_members_online' => $row_months['mostOn'],
'hits' => $row_months['hits'],
</Search>
<Replace>
'most_members_online' => $row_months['mostOn'],
'all_members_online' => $row_months['allOn'],
'hits' => $row_months['hits'],
</Replace>
<Search>
SELECT YEAR(date) AS stats_year, MONTH(date) AS stats_month, DAYOFMONTH(date) AS stats_day, topics, posts, registers, mostOn, hits
</Search>
<Replace>
SELECT YEAR(date) AS stats_year, MONTH(date) AS stats_month, DAYOFMONTH(date) AS stats_day, topics, posts, registers, mostOn, allOn, hits
</Replace>
<Search>
'most_members_online' => $row_days['mostOn'],
'hits' => $row_days['hits
</Search>
<Replace>
'most_members_online' => $row_days['mostOn'],
'all_members_online' => $row_days['allOn'],
'hits' => $row_days['hits']
</Replace>
FaSan