Tricky. Each user's session variables (username, etc) persist for 1 hour of non-use on the server, so even if I could come up with a way to check who has an open session, it wouldn't necessarily mean they were still reading - they could have left 59 minutes ago. But, with that limitation, it might be possible, I'd have to investigate.
The other way would be to update a field in the database every time someone clicks on a forum link. Maybe a ForumUser.LastClickDateTime, and then make the assumption that anybody who clicked something within the last 5 or 10 minutes is still reading. This would be more accurate, but I suspect it would put a greater burden on the SQL server. Still I am already incrementing the views count per topic whenever a topic is opened by a user, so maybe it could be done then. So effectively that would mean I could say "these people viewed a topic within the last 5 minutes" kind of thing. How's that sound?
EDIT: Alrightly, I've added a "Now" link (main forum page to the right of the "Logged On Today" link). This will show you forum members who have logged on or viewed a topic (causing the views count to increment) or posted or edited a reply in the last ten minutes. So basically members who are probably currently reading the forum.
Of course, it won't tell you who is reading without having logged in. Or who is still reading, but has taken more than 10 minutes since last opening a topic. And it will incorrectly show you those who left 9 minutes 59 seconds ago, etc, etc. Okay, so it's an estimate at best. |