Go Back   Pligg CMS Forum > Pligg Development > Modification Tutorials

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 02-04-2008, 08:51 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
Currently logged in

Reserved for finished mod.


Geoserv
Reply With Quote
  #2 (permalink)  
Old 02-04-2008, 08:53 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
What is wrong here:

in libs/smartyvariables.php:

Code:
// show count users logged in
$queued = $db->get_var('SELECT user_login from ' . table_users . ' where user_logged_in');
$main_smarty->assign('loggedin', $loggedin);
in my pligg.tpl:

Code:
{$loggedin}
but nothing shows up.

I know the query works.

Any ideas?

Geoserv.
Reply With Quote
  #3 (permalink)  
Old 02-04-2008, 09:06 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
Do I need to insert an echo in there somewhere?

Geoserv.
Reply With Quote
  #4 (permalink)  
Old 02-04-2008, 09:44 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 is wrong here:

in libs/smartyvariables.php:

Code:
// show count users logged in
$queued = $db->get_var('SELECT user_login from ' . table_users . ' where user_logged_in');
$main_smarty->assign('loggedin', $loggedin);
in my pligg.tpl:

Code:
{$loggedin}
but nothing shows up.

I know the query works.

Any ideas?

Geoserv.
You might have to do something like user_logged_in = 1 or 2 or 0 whichever value..
__________________
iGameit

helpthewriters.com
Reply With Quote
  #5 (permalink)  
Old 02-04-2008, 09:48 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
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
__________________
iGameit

helpthewriters.com

Last edited by manya1011; 02-04-2008 at 09:58 PM..
Reply With Quote
  #6 (permalink)  
Old 02-05-2008, 01:14 AM
Constant Pligger
Pligg Version: 9.9.0
Pligg Template: yget
 
Join Date: Jan 2008
Posts: 164
Thanks: 8
Thanked 24 Times in 16 Posts
I have noticed something that could be the cause for the if statement issue,

When I get the current time time(); it is completely different from a user recently modified time. Way Way off...

All I did was Add both the Users and an option for the time to display on the page, and they have a huge difference, Am i calling the time wrong??

Any ideas...
__________________
iGameit

helpthewriters.com
Reply With Quote
  #7 (permalink)  
Old 02-05-2008, 04:06 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
/bumpy to get other ideas..
__________________
iGameit

helpthewriters.com
Reply With Quote
  #8 (permalink)  
Old 02-05-2008, 05:13 PM
Constant Pligger
 
Join Date: Apr 2007
Posts: 1,071
Thanks: 53
Thanked 25 Times in 23 Posts
I donīt fully understand your code.It works if everyone would logout instead of being idle or just close the browser window? But it displays if someone logs in in every case, right?

Where does it fit in the Pligg architecture (tpl files or something)?
Reply With Quote
  #9 (permalink)  
Old 02-05-2008, 05:33 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
Just add the function to AnAlien's sidebar_friends.php

Then do a call to the function in the following like this

Code:
echo "<div class=\"tlb\" style=\"margin-top:-15px\"><span><a onclick=\"new Effect.toggle('sidefriends','blind', {queue: 'end'}); \">  <img src=\"".my_base_url."/templates/" . $the_template . "/images/expand.png\"  width=\"30\" height=\"29\"/></a></span><a href=\"".my_base_url."/user.php?login=test&view=viewfriends\">".$main_smarty->get_config_vars('PLIGG_Visual_Friends')."</a></div><div id=sidefriends>";


do_viewfriendsside();
do_viewallside();
echo "<table>";
echo "<tr>";
echo "<td>test</td><td>what</td>";
echo "</tr>";
echo "</table>";
echo "<li class=\"rmore\"><a href=\"".my_base_url."/user.php?view=viewfriends\">".$main_smarty->get_config_vars("PLIGG_Visual_What_Is_Pligg_Read_More")."</a></li>";
echo "</div>";
__________________
iGameit

helpthewriters.com
Reply With Quote
  #10 (permalink)  
Old 02-05-2008, 05:34 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
If someone manually logs out then it will show user off line, basically not list him in the list. If he doesn't logout, thats where the problem lies because the time thing is way off so it doesn't detect the 20minutes or 10minutes
__________________
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