News:

Join the Facebook Fan Page.

Main Menu

user online today

Started by HuwB, June 05, 2005, 06:21:00 PM

Previous topic - Next topic

HuwB

I notice that some of the themes available do not display the usersonline today mod, can someone tell me the code I will need to add and what file I will need to ad it to thanks

snork13

download the mod and you can see what needs to be done in the text file, but here it is:

<id>
OnLineUserToday_12
</id>

<version>
1.2
</version>

<mod info>
Add a list of user's OnLine on day, and add that in the Statistic's Section
</mod info>

<author>
FaSan
</author>

<homepage>
http://www.fasan.net/smf
</homepage>


<edit file>
Sources/BoardIndex.php
</edit file>

<search>
// Load the users online right now.
</search>

<replace>
// Load the users online today.
$forumtime = forum_time();
$midnight = ($forumtime) - (((date("H", $forumtime) + $modSettings['time_offset'])  * 3600) + (date("i", $forumtime) * 60) + (date("s", $forumtime)));

// 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 = array();

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'] = implode(', ', $link);
$context['num_users_today'] = $today['num_users'];

        trackStats(array('allOn' => $context['num_users_today']));

// Load the users online right now.
</replace>


<edit file>
Sources/Stats.php
</edit file>

<search>
MAX(mostOn) AS mostOn
</search>

<replace>
MAX(mostOn) AS mostOn, MAX(allOn) AS allOn
</replace>

<search>
'hits' => $row_months['hits'],
</search>

<replace>
'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, hits, allOn
</replace>

<search>
'hits' => $row_days['hits']
</search>

<replace>
'all_members_online' => $row_days['allOn'],
'hits' => $row_days['hits']
</replace>


<edit file>
Themes/default/BoardIndex.template.php
</edit file>

<search>
// If they are logged in, but SP1 style information is off... show a personal message bar.
</search>

<replace>
// "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>';

// If they are logged in, but SP1 style information is off... show a personal message bar.
</replace>

<edit file>
Themes/classic/BoardIndex.template.php
</edit file>

<search>
// If they are logged in, but SP1 style information is off... show a personal message bar.
</search>

<replace>
// "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>';

// If they are logged in, but SP1 style information is off... show a personal message bar.
</replace>

<edit file>
Themes/default/Stats.template.php
</edit file>

<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>


<edit file>
Themes/default/languages/Modifications.english.php
</edit file>

<search>
?>
</search>

<replace>
//OnLine Users Today
$txt['158bis'] = 'Users OnLine Today';
$txt['smf_stats_14bis'] = 'Users Online Today';

?>
</replace>


<edit file>
Themes/default/languages/Modifications.italian.php
</edit file>

<search>
?>
</search>

<replace>
//OnLine Users Today
$txt['158bis'] = 'Utenti OnLine nella Giornata di Oggi';
$txt['smf_stats_14bis'] = 'Presenze OnLine Giornaliere';

?>
</replace>


<edit file>
Themes/default/languages/Modifications.french.php
</edit file>

<search>
?>
</search>

<replace>
//OnLine Users Today
$txt['158bis'] = 'Visiteurs du jour';
$txt['smf_stats_14bis'] = 'Visiteurs du jour';

?>
</replace>


<edit file>
Themes/default/languages/Modifications.finnish.php
</edit file>

<search>
?>
</search>

<replace>
//OnLine Users Today
$txt['158bis'] = 'T&auml;n&auml;&auml;n paikalla olleet k&auml;ytt&auml;j&auml;t';
$txt['smf_stats_14bis'] = 'T&auml;n&auml;&auml;n paikalla olleet k&auml;ytt&auml;j&auml;t';

?>

<edit file>
Themes/default/languages/Modifications.spanish.php
</edit file>

<search>
?>
</search>

<replace>
//OnLine Users Today
$txt['158bis'] = 'Usuarios en línea Hoy';
$txt['smf_stats_14bis'] = 'Usuarios en línea Hoy';

?>
</replace>
Mods
Please DO NOT PM me with requests for individual support, but post your questions and concerns in the appropriate section of the forum where other users can benefit from them as well. Thank you.
I have been super busy as of late. Working on updates to all my modifications for 2.0.1

HuwB

thanks, it was only modifiying the board template in the default folder, but I was able to make those changes myself

thanks again

Advertisement: