|
|
It appears you are using a browser that is not based on Internet Explorer, this means you are not viewing the web as good as you should be. Other browsers might try to immitate Internet Explorer, but none can parse the web as it should like Internet Explorer can. So view the web as it was meant to be with Avant Browser!
|
| |
|
|
All times are GMT - 5 Hours
|
|
 |
Tue Mar 28, 2006 3:03 pm |
 |
Author |
Message |
lefty74  New TweakeR

Joined: 07 Mar 2006 Posts: 4 Words Posted: 800 Average Post: 200.00
|
| Post subject: Users online in the last x hours and AUC |
|
|
Hi, thanks for your AUC MOD, it looks great.
The only question I have, is there a way to make it work with the UsersOnlineToday MOD (modified to show online users in the last xhrs).
I have tried for the last 2 weeks to get it to work trying to use the help given in this forum already for other mods but somehow am stuck without achieving getting it to work...
This is the part of the index.php which I believe is the part that doesnt work. I gathered that the u.user_color_gc needed to be added in the query but any other attempts to get the color in the names were unsuccsessful
Thanks very much for any help you can give.
My testboard is here
| Code: | // Begin USERS ONLINE TODAY
// http://russ.isitaboat.co.uk/
//
// ORIGINAL CODE
//$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] );
//
// NEW CODE
//changed original code to use the last 24 hours instead of being based on date
$periodinseconds = ($board_config['users_online_today'] * 3600);
$uot_when_from = time() - $periodinseconds;
$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_color_gc, 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:i a', $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
|
|
|
| Post #1 |
|
|
 |
Tue Mar 28, 2006 6:36 pm |
 |
 |
Wed Mar 29, 2006 11:51 am |
 |
Author |
Message |
lefty74  New TweakeR

Joined: 07 Mar 2006 Posts: 4 Words Posted: 800 Average Post: 200.00
|
| Post subject: |
|
|
Thanks, I had a look at it. I have only a very small board with not many users so I prefer to see who was online for the last x hours rather then today. Also, I can easily change the hours in the ACP so I was just wondering whether there was a solution to make the mod on my board to work with the AUC mod.
If not, it can't be helped but thanks for looking  |
|
| Post #3 |
|
|
 |
Wed Mar 29, 2006 12:23 pm |
 |
Author |
Message |
aUsTiN Webmaster


Joined: 05 Jan 2005 Posts: 3684 Words Posted: 144,671 Average Post: 39.27 Location: USA
|
| Post subject: |
|
|
Sure it can be done.
Change
| Code: |
$sql = "SELECT u.user_id, u.username, , u.user_color_gc,
|
To
| Code: |
$sql = "SELECT u.user_id, u.username, u.user_color_gc,
|
Basically remove the extra comma.
Replace
| Code: |
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>';
}
|
With
| Code: |
$uot_username = CheckUsernameColor($row['user_color_gc'], $uot_username);
if ( ($row['user_level'] == ADMIN) && (!strstr('<span', $uot_username)) )
$uot_username = '<b><span style="color:#'. $theme['fontcolor3'] .'">'. $uot_username .'</span></b>';
elseif ( ($row['user_level'] == MOD) && (!strstr('<span', $uot_username)) )
$uot_username = '<b><span style="color:#'. $theme['fontcolor2'] .'">'. $uot_username .'</span></b>';
|
See what happens there. |
|
| Post #4 |
|
|
 |
Wed Mar 29, 2006 1:13 pm |
 |
Author |
Message |
lefty74  New TweakeR

Joined: 07 Mar 2006 Posts: 4 Words Posted: 800 Average Post: 200.00
|
| Post subject: |
|
|
Thanks a million Austin, it works great now.
I don't know anything about php stuff but am normally trying myself to fix things first. I tried loads of other variations before but never got it to work properly... plus forgetting my paypal pass AND the security questions didnt help either
Many thanks again! |
|
| Post #5 |
|
|
 |
Wed Mar 29, 2006 4:39 pm |
 |
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
Protected by phpBB Security © phpBB-TweakS phpBB Security Has Blocked 3,237 Exploit Attempts.
· Archive · Sitemap: Index · Sitemap: Forums · Sitemap: Topics · Sitemap: Posts ·
:: [ Load Time: 2.9 Seconds ] :: [ 29 Queries ] :: [ 3,624 Page(s) Viewed Today ] :: :: [ Todays Queries: 108,615 ] :: [ Highest Load: 1,396,429 Queries On May. 08, 2007 ] :: :: [ SQL Load: 61% Time: 1.8 ] :: [ PHP Load: 39% Time: 1.1 ] :: [ Debug: On ] :: [ GZIP: Enabled ] :: :: The server last rebooted 82 days, 2 hours, 26 minutes, 21 seconds ago. ::
|
|
|