[BETA] Online today

A place for MOD Authors to post and receive feedback on MODs still in development. No MODs within this forum should be used within a live environment! No new topics are allowed in this forum.
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

IMPORTANT: MOD Development Forum rules

On February 1, 2009 this forum will be set to read only as part of retiring of phpBB2.
rhs98
Registered User
Posts: 78
Joined: Thu Jan 29, 2004 7:00 pm
Location: UK

Post by rhs98 »

I'll have a look - brb :roll:

rhs98
Registered User
Posts: 78
Joined: Thu Jan 29, 2004 7:00 pm
Location: UK

Post by rhs98 »

Should be fixed - it was a variable which I had forgotten to rename.

If you have already installed it, do the following;

FIND:

Code: Select all

  $sql =  "SELECT u.user_id, u.username, u.user_allow_viewonline, u.user_level, u.user_lastvisit 
      FROM ".USERS_TABLE." u 
      WHERE u.user_lastvisit >= ". $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); 
   }
REPLACE WITH:

Code: Select all

  $sql =  "SELECT u.user_id, u.username, u.user_allow_viewonline, u.user_level, u.user_lastvisit 
      FROM ".USERS_TABLE." u 
      WHERE u.user_lastvisit >= ". $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); 
   }
If you haven't just download it again.

Liam_uk
Registered User
Posts: 24
Joined: Thu Nov 28, 2002 11:39 am
Location: Scotland

Post by Liam_uk »

so where do i get this mod then?

rhs98
Registered User
Posts: 78
Joined: Thu Jan 29, 2004 7:00 pm
Location: UK

Post by rhs98 »

First page, first post - download link... :wink:

User avatar
NoahK
Registered User
Posts: 217
Joined: Wed Nov 12, 2003 4:49 am
Location: Atlanta, GA
Contact:

Post by NoahK »

Another change I did... As it stands now it grabs users who have visited "today"... as opposed to the past 24 hours. So when midnight rolls around it looks as if no one has visited yet.

So I changed:

Code: Select all

$sql =  "SELECT u.user_id, u.username, u.user_allow_viewonline, u.user_level, u.user_lastvisit 
      FROM ".USERS_TABLE." u 
      WHERE u.user_lastvisit >= ". $uot_when_from . " 
      ORDER BY u.username ASC"; 
To:

Code: Select all

	$sql =  "SELECT u.user_id, u.username, u.user_allow_viewonline, u.user_level, u.user_lastvisit
		FROM ".USERS_TABLE." u
		WHERE u.user_lastvisit >= ".( time() - 86400 )."
		ORDER BY u.username ASC";
If you do the change, after midnight it will still show who visited for the previous day (or the last 24 hours, however you look at it).
Come play Final Fantasy Tactics: Online!
Features:
- Pick one of 351 class combinations. Battle 150 different monsters. Find over 2,200 weapons, armor, and items. Fight in tournaments or play the Gil Slots. Anything goes!

Liam_uk
Registered User
Posts: 24
Joined: Thu Nov 28, 2002 11:39 am
Location: Scotland

Post by Liam_uk »

nice one, but i am having problems with making it work with my template. i've tried to find the relevent part but its completely different from the sub silver template.

here my template

Code: Select all

<table width="100%" cellspacing="0" cellpadding="2" border="0" align="center">
  <tr> 
	<td align="left" valign="bottom"><span class="gensmall">
	<!-- BEGIN switch_user_logged_in -->
	<!---{LAST_VISIT_DATE}<br />--->
	<!-- END switch_user_logged_in -->
	{CURRENT_TIME}<br /></span><span class="nav"><a href="{U_INDEX}" class="nav">{L_INDEX}</a></span></td>
	<td align="right" valign="bottom" class="gensmall">
		<!-- BEGIN switch_user_logged_in -->
		<a href="{U_SEARCH_NEW}" class="gensmall">{L_SEARCH_NEW}</a><br /><a href="{U_SEARCH_SELF}" class="gensmall">{L_SEARCH_SELF}</a><br />
		<!-- END switch_user_logged_in -->
		<a href="{U_SEARCH_UNANSWERED}" class="gensmall">{L_SEARCH_UNANSWERED}</a></td>
  </tr>
</table>

<table width="100%" cellpadding="2" cellspacing="1" border="0">
  <tr> 
	<th colspan="2" class="thCornerL" height="25" nowrap="nowrap">&nbsp;{L_FORUM}&nbsp;</th>
	<th width="50" class="thTop" nowrap="nowrap">&nbsp;{L_TOPICS}&nbsp;</th>
	<th width="50" class="thTop" nowrap="nowrap">&nbsp;{L_POSTS}&nbsp;</th>
	<th class="thCornerR" nowrap="nowrap">&nbsp;{L_LASTPOST}&nbsp;</th>
  </tr>
  <!-- BEGIN catrow -->
  <tr> 
	<td class="catLeft" colspan="5" height="28"><span class="cattitle"><a href="{catrow.U_VIEWCAT}" class="cattitle">{catrow.CAT_DESC}</a></span></td>
	
  </tr>
  <!-- BEGIN forumrow -->
  <tr> 
	<td class="row1" align="center" valign="middle" height="50"><img src="{catrow.forumrow.FORUM_FOLDER_IMG}" alt="{catrow.forumrow.L_FORUM_FOLDER_ALT}" title="{catrow.forumrow.L_FORUM_FOLDER_ALT}" /></td>
	<td class="row1" width="100%" height="50"><span class="forumlink"> <a href="{catrow.forumrow.U_VIEWFORUM}" class="forumlink">{catrow.forumrow.FORUM_NAME}</a><br />
	  </span> <span class="genmed">{catrow.forumrow.FORUM_DESC}<br />
	  </span><span class="gensmall">{catrow.forumrow.L_MODERATOR} {catrow.forumrow.MODERATORS}</span></td>
	<td class="row2" align="center" valign="middle" height="50"><span class="gensmall">{catrow.forumrow.TOPICS}</span></td>
	<td class="row2" align="center" valign="middle" height="50"><span class="gensmall">{catrow.forumrow.POSTS}</span></td>
	<td class="row2" align="center" valign="middle" height="50" nowrap="nowrap"> <span class="gensmall">{catrow.forumrow.LAST_POST}</span></td>
  </tr>
  <!-- END forumrow -->
  <!-- END catrow -->
</table>

<table width="100%" cellspacing="0" border="0" align="center" cellpadding="2">
  <tr> 
	<td align="left" height="15" background=templates/urban/images/headbg.gif><span class="gensmall"><a href="{U_MARK_READ}" class="gensmall">{L_MARK_FORUMS_READ}</a></span></td>
	<td align="right" height="15" background=templates/urban/images/headbg.gif><span class="gensmall">{S_TIMEZONE}</span></td>
  </tr>
</table>

<table width="100%" cellpadding="3" cellspacing="1" border="0">
  <tr> 
	<td class="catHead" colspan="2" height="28"><span class="cattitle"><a href="{U_VIEWONLINE}" class="cattitle">{L_WHO_IS_ONLINE}</a></span></td>
  </tr>
  <tr> 
	
	<td class="row1" align="left" width="100%"><span class="gensmall">{TOTAL_POSTS}<br />{TOTAL_USERS}<br />{NEWEST_USER}</span>
	</td>
  </tr>
  <tr> 
	<td class="row1" align="left"><span class="gensmall">{TOTAL_USERS_ONLINE} &nbsp; [ {L_WHOSONLINE_ADMIN} ] &nbsp; [ {L_WHOSONLINE_MOD} ]<br />{RECORD_USERS}<br />{LOGGED_IN_USER_LIST}</span></td>
  </tr>
</table>

<table width="100%" cellpadding="1" cellspacing="1" border="0">
<tr>
	<td align="left" valign="top"><span class="gensmall">{L_ONLINE_EXPLAIN}</span></td>
</tr>
</table>

<!-- BEGIN switch_user_logged_out -->
<form method="post" action="{S_LOGIN_ACTION}">
  <table width="100%" cellpadding="3" cellspacing="1" border="0" class="forumline">
	<tr> 
	  <td class="catHead" height="28"><a name="login"></a><span class="cattitle">{L_LOGIN_LOGOUT}</span></td>
	</tr>
	<tr> 
	  <td class="row1" align="center" valign="middle" height="28"><span class="gensmall">{L_USERNAME}: 
		<input class="post" type="text" name="username" size="10" />
		&nbsp;&nbsp;&nbsp;{L_PASSWORD}: 
		<input class="post" type="password" name="password" size="10" maxlength="32" />
		&nbsp;&nbsp; &nbsp;&nbsp;{L_AUTO_LOGIN} 
		<input class="text" type="checkbox" name="autologin" />
		&nbsp;&nbsp;&nbsp; 
		<input type="submit" class="mainoption" name="login" value="{L_LOGIN}" />
		</span> </td>
	</tr>
  </table>
</form>
<!-- END switch_user_logged_out -->

<br clear="all" />

<table cellspacing="3" border="0" align="center" cellpadding="0">
  <tr> 
	<td width="20" align="center"><img src="templates/urban/images/folder_new.gif" alt="{L_NEW_POSTS}"/></td>
	<td><span class="gensmall">{L_NEW_POSTS}</span></td>
	<td>&nbsp;&nbsp;</td>
	<td width="20" align="center"><img src="templates/urban/images/folder.gif" alt="{L_NO_NEW_POSTS}" /></td>
	<td><span class="gensmall">{L_NO_NEW_POSTS}</span></td>
	<td>&nbsp;&nbsp;</td>
	<td width="20" align="center"><img src="templates/urban/images/folder_lock.gif" alt="{L_FORUM_LOCKED}" /></td>
	<td><span class="gensmall">{L_FORUM_LOCKED}</span></td>
  </tr>
</table>
i would appreciate it if someone could help me out. i'll return the favour in some way if i can

DK
Registered User
Posts: 231
Joined: Fri Aug 31, 2001 1:46 pm
Location: Champaign, IL
Contact:

Post by DK »

liam - looks like you did some kind of mod to the who is online area. anyhow the area you would be looking for is related to this bit of code you have:

Code: Select all

<tr>
   <td class="row1" align="left"><span class="gensmall">{TOTAL_USERS_ONLINE} &nbsp; [ {L_WHOSONLINE_ADMIN} ] &nbsp; [ {L_WHOSONLINE_MOD} ]<br />{RECORD_USERS}<br />{LOGGED_IN_USER_LIST}</span></td>
  </tr> 

Liam_uk
Registered User
Posts: 24
Joined: Thu Nov 28, 2002 11:39 am
Location: Scotland

Post by Liam_uk »

yeah, but what do i change it to?

fredol
Registered User
Posts: 188
Joined: Mon May 31, 2004 7:02 pm
Contact:

Post by fredol »

Hi,

This is a very cool MOD!! :D
Thanks, and since I did install it I also made some changes, hope you don't mind, here's what I now have:

Code: Select all

##############################################################
## MOD Title: Show online today
## MOD Author: rhs98 < phpbb@isitaboat.co.uk > (Russell Smith) http://www.isitaboat.co.uk
## MOD Description: Shows which users have been online today.
## MOD Version: 1.0.2
## 
## Installation Level: easy
## Installation Time: 5 Minutes
## Files To Edit:
##		includes/page_header.php
##              templates/subSilver/index_body.tpl
##              includes/sessions.php
##		language/lang_english/lang_main.php
## Included Files: n/a
## Generator: MOD Studio.net [Beta 3c 1.2.1306.29431]
##############################################################
## For Security Purposes, Please Check: http://www.phpbb.com/mods/ for the 
## latest version of this MOD. Downloading this MOD from other sites could cause malicious code 
## to enter into your phpBB Forum. As such, phpBB will not offer support for MOD's not offered 
## in our MOD-Database, located at: http://www.phpbb.com/mods/ 
##############################################################
## Author Notes:This does work fine with easy mod. Enjoy!
##
##		Please contact me on the forum @
##		http://www.isitaboat.co.uk/forum/ (example there also)
##############################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD 
##############################################################


#
#-----[ OPEN ]------------------------------------------
#
includes/page_header.php
#
#-----[ FIND ]------------------------------------------
#
if (defined('SHOW_ONLINE'))
#
#-----[ BEFORE, ADD ]------------------------------------------
#
$users_online_today=array();
#
#-----[ FIND ]------------------------------------------
#
{
#
#-----[ AFTER, ADD ]------------------------------------------
#
	//
	// 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] );

	// Parse dateformat to get timeformat -- NOT NEEDED IF YOU HAVE YESTERDAY/TODAY AT MOD INSTALLED!!
	$time_reg = '([gh][[:punct:][:space:]]{1,2}[i][[:punct:][:space:]]{0,2}[a]?[[:punct:][:space:]]{0,2}[S]?)';
	eregi($time_reg, $board_config['default_dateformat'], $regs);
	$board_config['default_timeformat'] = $regs[1];
	unset($time_reg);
	unset($regs);

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

	while ( $row = $db->sql_fetchrow($uot_result) )
	{
		$style_color = '';
		if ( $row['user_level'] == ADMIN )
		{
			$row['username'] = '<b>' . $row['username'] . '</b>';
			$style_color = 'style="color:#' . $theme['fontcolor3'] . '"';
		}
		else if ( $row['user_level'] == MOD )
		{
			$row['username'] = '<b>' . $row['username'] . '</b>';
			$style_color = 'style="color:#' . $theme['fontcolor2'] . '"';
		}

		if ( !$row['user_allow_viewonline'] )
		{
			$view_online = ( $userdata['user_level'] == ADMIN ) ? TRUE : FALSE;
			$row['username'] = '<i>' . $row['username'] . '</i>';
		}
	
		array_push($users_online_today, sprintf($lang['User_online'], '<a href="' . append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=" . $row['user_id']) . '"' . $style_color .'>' . $row['username'] . '</a>', create_date($board_config['default_timeformat'], $row['user_session_time'], $board_config['board_timezone'])));
	}
	
	if(count($users_online_today)==0)
	{
		array_push($users_online_today, $lang['None']);
	}

	
	//
	// Begin USERS ONLINE NOW
	//
#
#-----[ FIND ]------------------------------------------
#
	'LOGGED_IN_USER_LIST' => $online_userlist,
#
#-----[ AFTER, ADD ]------------------------------------------
#
	'USERS_TODAY' => implode(", ", $users_online_today),
#
#-----[ FIND ]------------------------------------------
#
#Note: full line longer
	'L_WHOSONLINE_MOD' => 
#
#-----[ AFTER, ADD ]------------------------------------------
#
	'L_USERS_ONLINE_TODAY' => $lang['Users_online_today'],
#
#-----[ OPEN ]------------------------------------------
#
templates/subSilver/index_body.tpl
#
#-----[ FIND ]------------------------------------------
#
#Note: full line longer
	<td class="row1" align="center" valign="middle" rowspan="2">
#
#-----[ IN-LINE FIND ]------------------------------------------
#
rowspan="2"
#
#-----[ IN-LINE REPLACE WITH ]------------------------------------------
#
#Note: if you don't have 2, then just add 1 to your actual number
rowspan="3"
#
#-----[ FIND ]------------------------------------------
#
#Note: full line longer
	<td class="row1" align="left"><span class="gensmall">{TOTAL_USERS_ONLINE}
#
#-----[ FIND ]------------------------------------------
#
  </tr>
#
#-----[ AFTER, ADD ]------------------------------------------
#
  <tr> 
	<td class="row1" align="left"><span class="gensmall">{L_USERS_ONLINE_TODAY}:&nbsp;{USERS_TODAY} &nbsp;</span></td>
  </tr>

#
#-----[ OPEN ]------------------------------------------
#
language/lang_english/lang_main.php
#
#-----[ FIND ]------------------------------------------
#
?>
#
#-----[ BEFORE, ADD ]------------------------------------------
#
$lang['Users_online_today'] = 'Users online today';
$lang['User_online'] = '%s (%s)';  // username, time of visit

		
# 
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------ 
#
# EoM
I didn't list all the changes I did, but:
:arrow: removed some stuff not needed (like check we don't get the same user_id twice, that can't be from USERS_TABLE, it's done for users online cause then the data are from SESSIONS_TABLE where it is possible)
:arrow: using the board default time format
:arrow: using $lang['None'] instead on 'None' ;)
:arrow: using a $lang['User_online'] so people can easily change how it is shown (first %s is the username (w/link) and second one is the time, so %s @ %s will be like your default ;))
:arrow: moved the $template thing with the others...
:arrow: some changes to the MOD, hope it make it working for more templates and/or if some MODs are already installed
:arrow: use user_session_time instead of user_lastvisit, so you actually get the real time of last visit, and you don't need to do any changes in sessions.php ;)

Real cool MOD, thanks
fredol

DK
Registered User
Posts: 231
Joined: Fri Aug 31, 2001 1:46 pm
Location: Champaign, IL
Contact:

Post by DK »

Liam_uk wrote: yeah, but what do i change it to?


i wouldnt chnge it - i would add the tr from the mod right after that block of yours I posted.

rhs98
Registered User
Posts: 78
Joined: Thu Jan 29, 2004 7:00 pm
Location: UK

Post by rhs98 »

All you need to really do Liam_uk is add the following code where ever you want the online list to appear;

Code: Select all

{TOTAL_USERS_ONLINE}
So if you know html - just put the above code in a td element or whatever - in the tpl file - and ignore the mods that I listed to templates/subSilver/index_body.tpl. Easy.

Example

Code: Select all

...
<tr><td>{TOTAL_USERS_ONLINE}</td></tr>
...
easy...

rhs98
Registered User
Posts: 78
Joined: Thu Jan 29, 2004 7:00 pm
Location: UK

Post by rhs98 »

NoahK wrote: Another change I did... As it stands now it grabs users who have visited "today"... as opposed to the past 24 hours. So when midnight rolls around it looks as if no one has visited yet.

So I changed:

Code: Select all

$sql =  "SELECT u.user_id, u.username, u.user_allow_viewonline, u.user_level, u.user_lastvisit 
      FROM ".USERS_TABLE." u 
      WHERE u.user_lastvisit >= ". $uot_when_from . " 
      ORDER BY u.username ASC"; 
To:

Code: Select all

	$sql =  "SELECT u.user_id, u.username, u.user_allow_viewonline, u.user_level, u.user_lastvisit
		FROM ".USERS_TABLE." u
		WHERE u.user_lastvisit >= ".( time() - 86400 )."
		ORDER BY u.username ASC";
If you do the change, after midnight it will still show who visited for the previous day (or the last 24 hours, however you look at it).


Not a great fan of this mod personally - it is "online today" - not online < 24hours...but anyway - I will include this in the near future (see list bellow). Each to their own!! :D

I am currently working on a simple admin interface, which will allow easy config and changing of things such as;
  • Format of the user - i.e. user@time or user etc
  • XML output - static file (non of this dodgy dynamic stuff :roll: :wink: ), so it can be intergrated with the rest of your site easily.
  • Config of if it displays the last 24hours (or X hours) - or the current standard of everyone after 12 that night.
  • Optionally listing the reverse - listing those users (only "active" users - probably defined as those online within the last week - again probably configurable) who haven't been online...i.e. when they were last seen.
Any other comments and or suggestions to add to this list are most welcome.

I am hoping these changes listed above will be ready in the next week or so.[/list]

Liam_uk
Registered User
Posts: 24
Joined: Thu Nov 28, 2002 11:39 am
Location: Scotland

Post by Liam_uk »

theres a bug, users have to logout for it to record when the user was last on. :?

rhs98
Registered User
Posts: 78
Joined: Thu Jan 29, 2004 7:00 pm
Location: UK

Post by rhs98 »

Hmmm...ok will have a look at this. :roll:

MaddoxX
Registered User
Posts: 450
Joined: Sat May 15, 2004 4:43 pm
Location: Russia

Post by MaddoxX »

Ah damnit i can't update if you keep rlsing NEW mods :(
Can't you make a update from the version you have displayed in the 1st post :/
:D

Post Reply

Return to “[2.0.x] MODs in Development”