
This hack is best suit for people that had already change the session lifetime. If you have ever tweak the session settings on the Global Settings, you will need to have this hack in order to display correct online user stats. For example if you had set your session lifetime to 90 minutes, your online user stats will be the frame within the 90 minutes. This is usually the case when we want to extend the time of login, but we will still want to have the real user online stats over maybe 10-20 minutes. So what should we do?
Step 1.
This code replaces the original helper.php code in the joomla /modules/mod_whoisonline folder. It works on my system – Joomla 1.5.X. We will need to change two part of the file in this tutorial. The first part are near line 28, and second part will be around 62.
Original Code
$query = 'SELECT guest, usertype, client_id' . ' FROM #__session' . ' WHERE client_id = 0';
Replace with the following code
$datenow = date("Y-m-d H:i:s");
$time_string = strtotime($datenow);
// Modified query below to only show members/users active in the last 10 minutes
$extra_time = 600; //example: 10 min x 60 sec
$online_time = ($time_string-$extra_time);
$query = "SELECT a.guest, a.usertype, a.client_id"
."\n FROM #__session AS a"
."\n WHERE a.client_id=0 AND a.time>'$online_time'";
Step 2.
Original Code
$query = 'SELECT DISTINCT a.username' . ' FROM #__session AS a' . ' WHERE client_id = 0' . ' AND a.guest = 0';
Replace with the following code
$datenow = date("Y-m-d H:i:s");
$time_string = strtotime($datenow);
// Modified query below to only show members/users active in the last 10 minutes
$extra_time = 600; //10 min x 60 sec
$online_time = ($time_string-$extra_time);
// New Query below to only show members/users active in the last 10 minutes
$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['name_format'] > 2) ? "a.username" : "u.name")." ASC";
Download
![]()
If you have problem with the code above, you can always download the source at here.
Joomla Who’s Online Module Minor Hack for showing the Actual User Online (977)
Be a link sponsor for this page now
[sponsorbox]
I hope you have enjoyed this post, be sure to subscribe to my rss feed by click the subscribe button at the top.
Good Luck!



Hi,
You have a Great Blog, I found your blog on google and read a few of your other posts. I just added you to my Google News Reader. Keep it up.
Jenny
Thanks for the great post. I always like to bookmark webmaster or website related posts like this one.
Cheers for the fantastic information – I enjoyed reading it!
This is an awesome blog! I really wish that someday I could have a page that is as well done as this..
I’m surfing the Internet seeking for relevant info like in your blog. I’m impressed with the content. Thnx for the info, keep up the nice work. I’ll bookmark your place so I can find for updates afterwards
be sure to submit to our feed and follow me on twitter to get the most update news and tuts.
hi
Hi how are you i really liked this.
Hey mate. I don’t follow many blogs, but yours is of thefew I follow.Have a nice day!
im looking for a fake guest online mod do u find any??please share with us
thx
tis is solution to this
Anyone knows where to find the real joomla module for "who's online"?
how about guest online + ip address?
thz Q very much
u just great!!!!
great stuff. Thanks a lot for your nice tutorial.
hm… got any ideas how to remove inactive guests after 10 mins?? like delete their sessions after 10 mins of inactivity or sth like this?