I want to display a list of forum threads currently being read by users (both logged in and guests).
I know there’s a table called ‘exp_online_users’ and that it has a weblog_id and a in_forum (y/n) - but I’m not sure where to find what people are currently doing in the forum.
Anyone know?
bump
If I turn SQL debugging on when entering the forum I get this SQL:
UPDATE `exp_online_users` SET `weblog_id` = '0', `member_id` = '1', `name` = 'bjorn', `ip_address` = 'xx.xx.xx.xx', `date` = '1187584199', `anon` = 'y', `site_id` = '1' WHERE site_id = '1' AND ip_address = 'xx.xx.xx.xx' AND member_id = '1'
Shouldn’t this set in_forum=’y’ in exp_online_users when I enter the forum?
Anyhow, I have an idea of maybe using the ‘date’ column above to collect a row from exp_forum_topics_read where lastvisit=’1187584199’;
.. and parse that to get the last read topic id.
Seems a bit hacky though - what do you think?
To be honest, I don’t think you can do that, at all. I am not actually looking at the db now, but I’d be surprised if the forum module kept track of which article was viewed when, and by whom. There certainly is no built-in way to display that data, so a direct SQL query, if it works, would certainly be your best bet.
(…) but I’d be surprised if the forum module kept track of which article was viewed when, and by whom.
Hmm, why would that surprise you - the “Who’s online”-list (and where they are) functionality exists in all major forums I know of (phpBB, vBulletin, invisionboard, SimpleMachines, etc.).
But yeah, it doesn’t seem to keep track of sessions (except for updating the exp_forum_topics_read) so could be a hard task.
Do you know if there’s a way to get that same info for weblogs?
Maybe it would be best to create an extra session plugin for this or something …
Well - check out the exp_forum_read_topics for my user:
a:21:{i:8287;i:1185986069;i:8072;i:1185986974;i:8270;i:1185994448;i:7945;i:1185995075;i:8082;i:1185995083;i:8132;i:1185995189;i:8290;i:1185995851;i:8289;i:1186066045;i:2030;i:1186080270;i:8292;i:1186145346;i:8276;i:1186502723;i:8169;i:1186502734;i:8164;i:1186502741;i:8245;i:1186597931;i:7565;i:1186597941;i:6546;i:1186597984;i:5917;i:1186597987;i:2863;i:1186598041;i:8283;i:1187109127;i:8293;i:1187422387;i:8291;i:1187584202;}
i:8072;i:i:8072;i:1185986974 8072 - the thread id 1185986974 - the timestamp this thread was read
.. so it should be possible to find this information for logged in users for forum posts.
For guests however it’s a different issue .. and also for weblogs.
So I’m thinking maybe this will have to be created as a plugin (which can be run both from the forum and weblog templates, that should be possible, no?)
Right. That used to be in a cookie, but it’s been in the db for some time. Well, you’d need to unserialise that, than work with that, sort by date, get the topic title and display it. If you have more than a handful of users, this probably becomes computationally intesive very quickly, for, ultimately little information. Just my € 0.02.
yeah .. well, I have a challenge of making my main page less static (without having to post a blog-entry each day 😊 ) .. so since I have 6 years of forum posts in Google’s index I figgured I could use the traffic to point my existing users to what “guests” find interesting.
I see traffic intensive forums pull this off with other scripts, so it should be possible.
But yeah, a plugin might be the best route …
thanks for your 2c 😊 ..
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.