[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.
Post Reply
rhs98
Registered User
Posts: 78
Joined: Thu Jan 29, 2004 7:00 pm
Location: UK

[BETA] Online today

Post by rhs98 »

Erm...my first mod...

It shows the users who have been online today. I find it useful, I hope you do to!!

Not sure of the status of it? I decidied to share it!

Latest version is in another thread click here

It works with easymod.
History wrote: 02/07/2004 - Linking to users profiles added to source (Thanks DK)
02/07/2004 - Mod to remove @time from the user list (as requested by battye here)
05/07/2004 - Fixed bug found by NoahK - problems with variable names
05/07/2004 - Fixed bug caused by above changes... :roll:
Last edited by rhs98 on Fri Jan 07, 2005 11:06 am, edited 11 times in total.

ayusuf
I've Been Banned!
Posts: 917
Joined: Fri Feb 06, 2004 11:00 pm
Location: Orlando,Fl
Contact:

Post by ayusuf »

tight mod.

User avatar
defender-uk
Registered User
Posts: 380
Joined: Tue Jun 01, 2004 9:06 am
Location: London, UK
Contact:

Post by defender-uk »

Mod already done.

Check out THIS SITE

Code: Select all

######################################################## 
## 
## MOD Title:   Users of the day
## MOD Version: 2.0
## Author:     ZoZo <zozo@etoiles.net> 
## 
## Description:  
## Displays, under the online users list, a list of the users
## who come during the last XX hours. Can also display the list
## of the users who didn't come. (see "Edit below")
## 
## Installation Level:  easy 
## Installation Time:  2-3 minutes 
## 
## Files To Edit:         3
##                   - /templates/subSilver/index_body.tpl
##                   - /language/lang_english/lang_main.php
##                   - /includes/page_header.php
## 
## Included Files:      None 
## 
######################################################## 
## VERSION HISTORY:
## 
## June 20th 2003: v2.0
## 1. The list's delay is customizable, but you must give a number in hours, 24 by default.
## 2. There's now a counter for each list.
## 3. The MOD doesn't display the list of the users who didn't visit by default.
## 
## October 28th 2002: v1.1
## 1. The MOD uses the database variable "user_session_time" instead of "user_lastvisit", which is updated only when the user logs out.
##  
## October 15th 2002: v1.0
## 1. Created main features.
##    
######################################################## 
## TODO LIST:
## 
## 1. Don't restrict the time unit to hours.
## 
######################################################## 
##        PLEASE REPORT ANY BUGS OR SUGGESTIONS       ##
######################################################## 

# 
#-----[ ACTION: open ]---------------------------------
# 
/templates/subSilver/index_body.tpl

# 
#-----[ ACTION: find ]---------------------------------
# 
	<td class="row1" align="center" valign="middle" rowspan="2"><img src="templates/subSilver/images/whosonline.gif" alt="{L_WHO_IS_ONLINE}" /></td>

# 
#-----[ ACTION: replace by ]---------------------------
# 
	<td class="row1" align="center" valign="middle" rowspan="3"><img src="templates/subSilver/images/whosonline.gif" alt="{L_WHO_IS_ONLINE}" /></td>

# 
#-----[ ACTION: find ]---------------------------------
# 
 	<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>

# 
#-----[ ACTION: add after ]----------------------------
# 
  </tr>
  <tr> 
	<td class="row1" align="left"><span class="gensmall">{USERS_OF_THE_DAY_LIST}</span></td>

# 
#-----[ ACTION: repeat for all templates ]-------------
# 



# 
#-----[ ACTION: open ]--------------------------------
# 
/language/lang_english/lang_main.php

# 
#-----[ ACTION: find ]--------------------------------
# 
$lang['Registered_users'] = 

# 
#-----[ ACTION: add before ]--------------------------
# 
$lang['Day_users'] = '%d registered users visit during the last %d hours:';
$lang['Not_day_users'] = '%d registered users <span style="color:red">DIDN\'T</span> visit during the last %d hours:';

# 
#-----[ ACTION: repeat for all languages ]------------
# 



# 
#-----[ ACTION: open ]--------------------------------
# 
/includes/page_header.php

# 
#-----[ ACTION: find ]--------------------------------
# 
	'LOGGED_IN_USER_LIST' => $online_userlist,

# 
#-----[ ACTION: add after ]---------------------------
# 
	'USERS_OF_THE_DAY_LIST' => $day_userlist,

# 
#-----[ ACTION: find ]--------------------------------
# 
//
// Obtain number of new private messages
// if user is logged in
//

# 
#-----[ ACTION: add before ]--------------------------
# 
//
// Users of the day MOD
//

// ############ Edit below ############
// #
$display_not_day_userlist = 0;	// change to 1 here if you also want the list of the users who didn't visit to be displayed
$users_list_delay = 24;		// change here to the number of hours wanted for the list
// #
// ############ Edit above ############

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

$day_userlist = '';
$day_users = 0;
$not_day_userlist = '';
$not_day_users = 0;

while( $row = $db->sql_fetchrow($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'] )
	{
		$user_day_link = '<a href="' . append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=" . $row['user_id']) . '"' . $style_color .'>' . $row['username'] . '</a>';
	}
	else
	{
		$user_day_link = '<a href="' . append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=" . $row['user_id']) . '"' . $style_color .'><i>' . $row['username'] . '</i></a>';
	}
	if ( $row['user_allow_viewonline'] || $userdata['user_level'] == ADMIN )
	{
		if ( $row['user_session_time'] >= ( time() - $users_list_delay * 3600 ) )
		{
			$day_userlist .= ( $day_userlist != '' ) ? ', ' . $user_day_link : $user_day_link;
			$day_users++;
		}
		else
		{
			$not_day_userlist .= ( $not_day_userlist != '' ) ? ', ' . $user_day_link : $user_day_link;
			$not_day_users++;
		}
	}
}

$day_userlist = ( ( isset($forum_id) ) ? '' : sprintf($lang['Day_users'], $day_users, $users_list_delay) ) . ' ' . $day_userlist;

$not_day_userlist = ( ( isset($forum_id) ) ? '' : sprintf($lang['Not_day_users'], $not_day_users, $users_list_delay) ) . ' ' . $not_day_userlist;

if ( $display_not_day_userlist )
{
	$day_userlist .= '<br />' . $not_day_userlist;
}

//
// End of MOD
//



# 
#-----[ ACTION: save/close all ]----------------------
# 

# 
#-----[ ACTION: upload the modified files ]-----------
# 

# 
#-----[ ACTION: enjoy ]-------------------------------
# 

# 
#-----[ PLEASE REPORT ANY BUGS OR SUGGESTIONS]--------
# 

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

Post by rhs98 »

Oh well, only took an hour! :D

User avatar
defender-uk
Registered User
Posts: 380
Joined: Tue Jun 01, 2004 9:06 am
Location: London, UK
Contact:

Post by defender-uk »

Don;t give up though, as that version has a bug in it, for some reason or another, after 12 hours it drops the guests total, and the board goes from 200+ guests to 30 odd :(

So if yours becomes more stable, then phpBB may give it the green light and include it in the database :)

User avatar
battye
Extension Customisations
Extension Customisations
Posts: 10943
Joined: Wed Feb 11, 2004 11:02 am
Location: Australia
Contact:

Post by battye »

Installed it and it works fine :)

I do have one question though, how can I remove the @ 1:23pm or whatever it is?

at the moment it says:

Users online today: Bacon @ 7:03pm, battye @ 9:47am, Boozybaz @ 12:28am, dogmeat @ 1:06am, gersfan @ 4:51am, grinch2171 @ 3:17am, me here @ 2:26am, Putt-Putt @ 5:21pm, quicksilver @ 5:48am, Rat @ 4:49pm, Red XIII @ 1:59am, tunebud @ 6:29am, Vladd44 @ 1:09pm

I want it to simply say

Users online today: Bacon, battye, Boozybaz, dogmeat, gersfan, grinch2171, me here, Putt-Putt, quicksilver, Rat, Red XIII, tunebud, Vladd44.

In the right colours still :D

thanks :D
Customisations Team Member

https://github.com/battye/php-array-parser - Give it a Star! :D

User avatar
Rookie7
Registered User
Posts: 189
Joined: Mon Mar 10, 2003 3:32 pm
Contact:

Post by Rookie7 »

defender-uk wrote: Mod already done.

Check out THIS SITE


This mod is totally buggy and seems to take up a lot of server load. I DO NOT recommend using this mod. So...keep developing your mod rhs98.

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

Post by rhs98 »

Sorry - did you mean his mod was buggy or mine?

Has anyone apart from me tried this out yet?

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

Post by MaddoxX »

Yeh i also want to know which one is the best and does not have bugs
:D

User avatar
battye
Extension Customisations
Extension Customisations
Posts: 10943
Joined: Wed Feb 11, 2004 11:02 am
Location: Australia
Contact:

Post by battye »

rhs98 wrote: Sorry - did you mean his mod was buggy or mine?


Has anyone apart from me tried this out yet?
battye wrote: Installed it and it works fine :)

I do have one question though, how can I remove the @ 1:23pm or whatever it is?

at the moment it says:

Users online today: Bacon @ 7:03pm, battye @ 9:47am, Boozybaz @ 12:28am, dogmeat @ 1:06am, gersfan @ 4:51am, grinch2171 @ 3:17am, me here @ 2:26am, Putt-Putt @ 5:21pm, quicksilver @ 5:48am, Rat @ 4:49pm, Red XIII @ 1:59am, tunebud @ 6:29am, Vladd44 @ 1:09pm

I want it to simply say

Users online today: Bacon, battye, Boozybaz, dogmeat, gersfan, grinch2171, me here, Putt-Putt, quicksilver, Rat, Red XIII, tunebud, Vladd44.

In the right colours still :D

thanks :D


:)
Customisations Team Member

https://github.com/battye/php-array-parser - Give it a Star! :D

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

Post by DK »

battye wrote: Installed it and it works fine :)

I do have one question though, how can I remove the @ 1:23pm or whatever it is? ..
I want it to simply say

Users online today: Bacon, battye, Boozybaz, dogmeat, gersfan, grinch2171, me here, Putt-Putt, quicksilver, Rat, Red XIII, tunebud, Vladd44.



thats easy. in includes/page_header.php find the following code this mod had you add:

Code: Select all

array_push($users_online_today,sprintf("%s @ %s",$username,create_date('g:ia', $row['user_lastvisit'], $board_config['board_timezone'])));
comment out that line and make a new line under it simply this:

Code: Select all

array_push($users_online_today, $username);

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

Post by DK »

here's another quick possible addition if anyone wants it:


this will make the users listed each link to their own profile:

Find:

Code: Select all

array_push($users_online_today,sprintf("%s @ %s",$username,create_date('g:ia', $row['user_lastvisit'], $board_config['board_timezone'])));

Before ADD

Code: Select all

$username = '<a href="profile.php?mode=viewprofile&u=' .$user_id .'">' .$username .'</a>';

User avatar
Rookie7
Registered User
Posts: 189
Joined: Mon Mar 10, 2003 3:32 pm
Contact:

Post by Rookie7 »

rhs98 wrote: Sorry - did you mean his mod was buggy or mine?

Has anyone apart from me tried this out yet?


Sorry, I meant his mod.

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

Post by MaddoxX »

I have it installed and ur mod just works "Perfect" I added 1 addition that DK made ;)
:D

User avatar
battye
Extension Customisations
Extension Customisations
Posts: 10943
Joined: Wed Feb 11, 2004 11:02 am
Location: Australia
Contact:

Post by battye »

Cheers DK :D
Customisations Team Member

https://github.com/battye/php-array-parser - Give it a Star! :D

Post Reply

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