[BETA] UOT (Users 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.
luvz2drv
Registered User
Posts: 47
Joined: Mon Nov 21, 2005 5:31 am

UOT and Color Groups

Post by luvz2drv »

I have Advanced Group Color Management MOD Version: 1.2.3
installed and also // Begin USERS ONLINE TODAY
// http://russ.isitaboat.co.uk/ //

the color mod is not effecting the UOT area.. I have tried mods listed to get it to go but still no go get errors..

is my current listing in my index.php please help

Code: Select all

//
// Begin USERS ONLINE TODAY
// http://russ.isitaboat.co.uk/
//  
$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

sini
Registered User
Posts: 8
Joined: Mon Oct 23, 2006 8:15 pm
Contact:

Critical Error

Post by sini »

FIND FAILED: In file [templates/subSilver/index_body.tpl] could not find:

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

MOD script line #164 :: FAQ :: Report

help please...

frontosa
Registered User
Posts: 26
Joined: Sat Oct 28, 2006 9:20 am

Who is Online

Post by frontosa »

ok at the bottom of my page i have Who is Online.
then under that i only get a : in its own box
my name dont show up and it dont say users online today help me plz.

User avatar
Moto
Registered User
Posts: 127
Joined: Thu Nov 23, 2006 7:16 pm

Post by Moto »

Great mod works perfect with subsilver

im using terayon v2 theme but it doesnt show the mod,please can somebody help ,maybe somebody can post the code so i just have to copy and paste it into the correct file,im a noob at php... :)

User avatar
lefty74
Registered User
Posts: 3649
Joined: Wed Sep 14, 2005 8:26 pm
Location: NL
Contact:

Post by lefty74 »

sini & frontosa
have you doublechecked your install? it is easy to add something before instead of after etc...

Moto, you need to modify your terayon template file in the same manner as the subsilver ones...

They may alter slightly so when installing the mod changes the lines you are asked to find may not be a 100% match with the code from other templates.
lefty74
zoocrew.eu - help us save our wildlife
My MODS | Due to lack of time I unfortunately am unable to work on my mods anymore, anyone who has ideas to improve them and would like to take any of them over, please PM me.

User avatar
RMcGirr83
Recognised Extension Developer
Posts: 21034
Joined: Wed Jun 22, 2005 4:33 pm
Location: Your display
Name: Rich McGirr
Contact:

Re: UOT and Color Groups

Post by RMcGirr83 »

luvz2drv wrote: I have Advanced Group Color Management MOD Version: 1.2.3
installed and also // Begin USERS ONLINE TODAY
// http://russ.isitaboat.co.uk/ //

the color mod is not effecting the UOT area.. I have tried mods listed to get it to go but still no go get errors..

is my current listing in my index.php please help


FIND this

Code: Select all

$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";
AFTER ADD

Code: Select all

//-- mod : Advanced Group Color Management -------------------------------------
//-- add
			$sql = str_replace('SELECT ', 'SELECT u.user_group_id, u.user_session_time, ', $sql);
//-- fin mod : Advanced Group Color Management ---------------------------------

FIND

Code: Select all

	//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>';
		}

and replace with this

Code: Select all


	//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>';
		}
*/
$uot_style = "color : #' . $colors->get_user_color($row['user_group_id'], $row['user_session_time']) . ';" class="username_color"';
$uot_username = '<b>' . $uot_username . '</b>';
Not tested btw.

luvz2drv
Registered User
Posts: 47
Joined: Mon Nov 21, 2005 5:31 am

your code

Post by luvz2drv »

I tried the code the sql seems to work but not the

//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>';
}
*/
$uot_style = "color : #' . $colors->get_user_color($row['user_group_id'], $row['user_session_time']) . ';" class="username_color"';
$uot_username = '<b>' . $uot_username . '</b>';

just my use anyways

User avatar
drathbun
Former Team Member
Posts: 12204
Joined: Thu Jun 06, 2002 3:51 pm
Location: TOPICS_TABLE
Contact:

Post by drathbun »

I had an opportunity to review this code for someone on another site, and there are some interesting coding choices made by the original author. I am basing this on the code that is available via the download link in the first post. Is there a newer download link somewhere? I don't want to post my suggestions on old code...
I blog about phpBB: phpBBDoctor blog
Still using phpbb2? So am I! Click below for details
Image

User avatar
45ish
Registered User
Posts: 81
Joined: Sun Nov 26, 2006 6:38 am
Location: usa canada uk - where ever the english language takes me!
Contact:

Post by 45ish »

I don't know, but I want this! What should I do? It is in the development threads and I am not sure how many tweaks I will need to do to it.

User avatar
lefty74
Registered User
Posts: 3649
Joined: Wed Sep 14, 2005 8:26 pm
Location: NL
Contact:

Post by lefty74 »

There seem to be two versions, one is the online users today, the other one is an altered one that shows users online in the last 24h.

http://www.phpbb.com/phpBB/viewtopic.ph ... 64#2088964
lefty74
zoocrew.eu - help us save our wildlife
My MODS | Due to lack of time I unfortunately am unable to work on my mods anymore, anyone who has ideas to improve them and would like to take any of them over, please PM me.

User avatar
drathbun
Former Team Member
Posts: 12204
Joined: Thu Jun 06, 2002 3:51 pm
Location: TOPICS_TABLE
Contact:

Post by drathbun »

lefty74 wrote: There seem to be two versions, one is the online users today, the other one is an altered one that shows users online in the last 24h.

http://www.phpbb.com/phpBB/viewtopic.ph ... 64#2088964

Ok, thanks. The second version has the same issues the first one does. :-) There are two queries when there could only be one, and there are variables that are used that are not initialized, among other issues. Is the original MOD author still participating in the topic? If not, I'll just write up my own code rather than submit suggestings for this one.
I blog about phpBB: phpBBDoctor blog
Still using phpbb2? So am I! Click below for details
Image

User avatar
lefty74
Registered User
Posts: 3649
Joined: Wed Sep 14, 2005 8:26 pm
Location: NL
Contact:

Post by lefty74 »

no the original author has been long gone...

thanks drathbun
lefty74
zoocrew.eu - help us save our wildlife
My MODS | Due to lack of time I unfortunately am unable to work on my mods anymore, anyone who has ideas to improve them and would like to take any of them over, please PM me.

luvz2drv
Registered User
Posts: 47
Joined: Mon Nov 21, 2005 5:31 am

yes we have been solo on this one now

Post by luvz2drv »

Solo on this one tryign to peice it together -- big thing I am sure most of us are looking for is tha the UOT display with the Advanced Color Groups Mod.. in my case


thanks
but all this by the looks of it is taken care of in 3.0

User avatar
drathbun
Former Team Member
Posts: 12204
Joined: Thu Jun 06, 2002 3:51 pm
Location: TOPICS_TABLE
Contact:

Re: yes we have been solo on this one now

Post by drathbun »

luvz2drv wrote: Solo on this one tryign to peice it together -- big thing I am sure most of us are looking for is tha the UOT display with the Advanced Color Groups Mod.. in my case

Can you provide a link to the specific Advanced Color Groups MOD for me to review too?

This MOD should take about an hour to put together. :-) I've looked at the code, and there are definitely some things that can be done differently. I won't be starting with this code but providing the same functionality, or at least the way I see that it should be done.

The portion used to highlight users is copied right from the standard phpBB code, where it uses the theme colors to highlight users, moderators, and administrators. So I would do the same thing. What I would do differently is obtain the results in a single query (rather than two as are currently in this MOD) and clean up the loop a bit. I'm going to start my own topic here shortly, and will post a link here
I blog about phpBB: phpBBDoctor blog
Still using phpbb2? So am I! Click below for details
Image

luvz2drv
Registered User
Posts: 47
Joined: Mon Nov 21, 2005 5:31 am

the mod used

Post by luvz2drv »

the color group mod I used was

http://www.phpbb.com/phpBB/viewtopic.ph ... highlight=

thanks been looking for these 2 working together for a long time

Post Reply

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