Skip to Content Skip to Menu

fix: hack to show 'who's online' last 20 min

16 years 1 month ago #76488 by carsten888
I got a community site where users can blog. I set the session time realy long so users don't get logged off while writing a blog. But then, in the CB module 'who's online', there is a huge list of users, most of whom are actually not online. This is how I fixed that.

I changed the query so it only shows users who have been active the last 20 minutes.

I forgot to mention the module I am using is Community-Builders 'who's online'.

file:
mod_comprofileronline.php
line:
50
[code:1]$query = "SELECT DISTINCT a.username, a.userid, u.name"
."\n FROM #__session AS a, #__users AS u"
."\n WHERE (a.userid=u.id) AND (a.guest = 0) AND (NOT ( a.usertype is NULL OR a.usertype = '' ))"
."\n ORDER BY ".(($ueConfig > 2) ? "a.username" : "u.name"«»)." ASC";[/code:1]
change to:
[code:1]$datenow = date("Y-m-d H:i:«»s"«»);
$time_string = strtotime($datenow);
$extra_time = 1200; //20 min x 60 sec
$online_time = ($time_string-$extra_time);

$query = "SELECT DISTINCT a.username, a.userid, u.name"
."\n FROM #__session AS a, #__users AS u"
."\n WHERE (a.userid=u.id) AND (a.guest = 0) AND (NOT ( a.usertype is NULL OR a.usertype = '' )) AND a.time>'$online_time'"
."\n ORDER BY ".(($ueConfig > 2) ? "a.username" : "u.name"«»)." ASC";[/code:1]


I hope that helps someone:)

Please Log in or Create an account to join the conversation.

  • bomzin
  • bomzin
  • OFFLINE
  • Posts: 5
  • Thanks: 0
  • Karma: 0
15 years 9 months ago #87414 by bomzin
I tried this with the latest Joomla 1.5.9 with CB 1.2 , code was just a little different on the latest CB , this didn't cause the desired affect . It had no affect what so ever .

Is there something else that may have to be done with this on the latest release of CB ?

Please Log in or Create an account to join the conversation.

Moderators: beatnantkrileon
Powered by Kunena Forum