Users Online Today
Специално на мене този мод много ми харесва :)

Показва всички регистрирани потребители който са влизали през целия ден


* Отваряме index.php

намираме
else
{
message_die(GENERAL_MESSAGE, $lang['No_forums']);
}


след него поставяме
//
// Begin USERS ONLINE TODAY
//
$uot_this_timestamp_array = getdate();
$uot_when_from = mktime ( 0 , 0 , 0 , $uot_this_timestamp_array[mon] , $uot_this_timestamp_array[mday] , $uot_this_timestamp_array[year] );



$sql = "SELECT count(*) cnt
FROM ".USERS_TABLE." u
WHERE u.user_session_time >= ". $uot_when_from . "
ORDER BY u.username ASC";
if ( !($uot_result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not obtain regd user/online information', '', __LINE__, __FILE__, $sql);
}

$row = $db->sql_fetchrow($uot_result);
$uot_count = $row['cnt'];



$sql = "SELECT u.user_id, u.username, u.user_allow_viewonline, u.user_level, user_session_time
FROM ".USERS_TABLE." u
WHERE u.user_session_time >= ". $uot_when_from . "
ORDER BY u.username ASC";
if ( !($uot_result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not obtain regd user/online information', '', __LINE__, __FILE__, $sql);
}




$users_online_today=array();

$uot_hidden_count = 0;

while ( $row = $db->sql_fetchrow($uot_result) )
{
//counter stuff
$$which_counter++;
$row_color = ( $$which_counter % 2 ) ? $theme['td_color1'] : $theme['td_color2'];
$row_class = ( $$which_counter % 2 ) ? $theme['td_class1'] : $theme['td_class2'];

//generate the user name (robbed from the code above)
$uot_user_id = $row['user_id'];

//reset the style...
$uot_style = '';

if ( $uot_user_id != $prev_user )
{
$uot_username_plain = $uot_username = $row['username'];

if ( $row['user_level'] == ADMIN )
{
$uot_style = 'style="color:#' . $theme['fontcolor3'] . ';"';
$uot_username = '<b>' . $uot_username . '</b>';
}
else if ( $row['user_level'] == MOD )
{
$uot_style = 'style="color:#' . $theme['fontcolor2'] . ';"';
$uot_username = '<b>' . $uot_username . '</b>';
}

if ( !$row['user_allow_viewonline'] )
{
$uot_hidden_count++;
$view_online = ( $userdata['user_level'] == ADMIN ) ? true : false;
$uot_username = $lang['UOT_hidden_start'] . $uot_username . $lang['UOT_hidden_end'];
}
else
{
$view_online = true;
}

}

//annon does not have a profile...
if($row['user_id']>0){
$uot_username = sprintf('<a href="profile.php?mode=viewprofile&u=%d" title="%s was last here at: %s" %s>%s</a>',$uot_user_id,$uot_username_plain,create_date('g:ia', $row['user_session_time'], $board_config['board_timezone']),$uot_style,$uot_username);
}

//this will show just the user's name, with the time in the tool tip.
if($view_online)
{
array_push($users_online_today,$uot_username);
}

}

if(count($users_online_today)==0){
array_push($users_online_today,$lang['UOT_none']);
}

if( $userdata['user_level'] == ADMIN && $uot_hidden_count>0){
array_push($users_online_today,sprintf($lang['UOT_hidden'], $uot_hidden_count));
}


$template->assign_vars(array(
'UOT_TITLE' => $lang['UOT_title'],
'UOT_COUNT' => $uot_count,
'UOT_LIST' => implode(", ",$users_online_today)
)
);
//end of UOT


Save

* Отваряме templates/твоя_темплейт/index_body.tpl

намираме
<tr>
<td class="row1" align="center" valign="middle" rowspan="2"><img src="templates/subSilver/images/whosonline.gif" alt="{L_WHO_IS_ONLINE}" /></td>


заместваме с
<tr>
<td class="row1" align="center" valign="middle" rowspan="3"><img src="templates/subSilver/images/whosonline.gif" alt="{L_WHO_IS_ONLINE}" /></td


сигорно забелязвате това което заместваме почти няма разлика можете само да замените rowspan="2" със rowspan="3" предполагам че може да има разлика ако сте поставяли някакъв друг мод там
така да продължаваме нататък

намираме
<td class="row1" align="left"><span class="gensmall">{TOTAL_USERS_ONLINE}   [ {L_WHOSONLINE_ADMIN} ]   [ {L_WHOSONLINE_MOD} ]<br />{RECORD_USERS}<br />{LOGGED_IN_USER_LIST}</span></td>
</tr>


след него поставяме
<tr>
<td class="row1" align="left"><span class="gensmall"><b>{UOT_COUNT}</b> {UOT_TITLE}: {UOT_LIST} </span></td>
</tr>


Save

*Отваряме language/твоя_език/main_lang.php

намираме
?>

намира се точно накрая :)


преди него поставяме
$lang['UOT_title'] = 'Users online today';
$lang['UOT_none'] = 'None';
$lang['UOT_hidden_start'] = '';
$lang['UOT_hidden_end'] = ' (hidden)';
$lang['UOT_hidden'] = ' (%d hidden)';



и вече сме готови

Save

Ето и картинка на ефекта :)




/ Трябва да сте регистриран за да напишете коментар /
От: webdeveloper
5:47 06-07-2010
Could not obtain regd user/online information

DEBUG MODE

SQL Error : Column name 'u.username' is invalid in the ORDER BY clause because it is not contained in an aggregate function and there is no GROUP BY clause.

SELECT count(*) cnt FROM battleforumche_users u WHERE u.user_session_time >= 1278363600 ORDER BY u.username ASC

Line : 479
File : index.php
1