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:)