Go Back   Pligg CMS Forum > Pligg Development > Modification Tutorials

Reply
 
LinkBack Thread Tools Display Modes
  #11 (permalink)  
Old 02-05-2008, 07:22 PM
Banned
Pligg Version: 9.8.
Pligg Template: Custom
 
Join Date: Feb 2007
Location: Canada
Posts: 849
Thanks: 74
Thanked 49 Times in 45 Posts
Quote:
Originally Posted by manya1011 View Post
I have also worked on something. Similar but different approach yours might be better.
Code:
function do_viewallside() {
 global $db, $user, $the_template,$current_user,$main_smarty;
    
	$online2 =  1;
    $idle2 = 2;    

$onlineLimit2 = time() - $online2*60;
$idleLimit2 =  time() - $idle2*60;

$sql = "SELECT  user_login, user_modification, user_lastactivity, user_logged_in FROM " . table_users . " WHERE user_logged_in = 1";
$list_users = $db->get_results($sql);

echo "<table border=\"0\" style=\"margin-bottom:25px\">";
echo "<tr><th colspan=\"3\" style=\"text-align=center\">Who is Online</th></tr>";
if($list_users) {
	foreach($list_users as $row) {
		$lastactivity = strtotime($row->user_modification);
		   if ($idleLimit2 < $lastactivity) {    
       			 if($onlineLimit2 < $lastactivity) {
					echo "<tr>";
						echo "<td><a href=\"".my_base_url."/user.php?login=$row->user_login&view=profile\">$row->user_login</a></td>";
						echo '<td><img src='.my_pligg_base.'/templates/'.$the_template.'/images/friends_online.ico alt="online" style="margin-left:4px"></td>';
					echo '</tr>';
				} else {
				}
			}
	}
}
echo "<table>";
}
The code detect who is online and who is offline properly

But the IF statement highlighted don't work well for some reason. So it doesn't detect if user has no activity for some time. Meaning that if he doesn't logout himself it will detect him as Online, I think maybe it hasn't taken effect yet, but I set the value low, so I think it should have.

ANy Help thanks.


This was taken from the Friend module by AnAlien http://forums.pligg.com/pligg-tutori...-activity.html
What file are you putting this in?

Geoserv.
Reply With Quote
  #12 (permalink)  
Old 02-05-2008, 09:32 PM
Constant Pligger
Pligg Version: 9.9.0
Pligg Template: yget
 
Join Date: Jan 2008
Posts: 164
Thanks: 8
Thanked 24 Times in 16 Posts
Quote:
Originally Posted by Geoserv View Post
What file are you putting this in?

Geoserv.
sidebar_friends.php Which goes in the root..
__________________
iGameit

helpthewriters.com
Reply With Quote
Reply

Thread Tools
Display Modes
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Similar Threads
Thread Thread Starter Forum Replies Last Post
Is there a reason incomplete submits are logged in the DB? swiper Modification Tutorials 2 01-24-2008 01:29 PM
EVB option always says I'm logged out! bbrian017 General Help 5 01-18-2008 04:12 PM
Successfully logged out message formicin Suggestions 1 03-08-2007 12:48 PM
Ajax dialog if user tries to vote without being logged in (digg-like) elder Modification Tutorials 12 12-03-2006 03:52 PM


Search Engine Friendly URLs by vBSEO 3.2.0