How to show unread subforums?
Posted
by bilygates
on Stack Overflow
See other posts from Stack Overflow
or by bilygates
Published on 2010-02-17T21:34:08Z
Indexed on
2010/03/27
6:03 UTC
Read the original article
Hit count: 309
I have written a simple forum in PHP using PostgreSQL. The forum consists of a number of subforums (or categories, if you like) that contain topics. I have a table that stores when was the last time a user visited a topic. It's something like this: user_id, topic_id, timestamp.
I can easily determine what topics should be marked as unread by comparing the timestamp of the last topic reply with the timestamp of the last user visit.
My question is: how do I efficiently determine what subforums (categories) should be marked as unread? All I've come up with is this: every time a user visits a topic, update the visit timestamp and check if all the topics from the current subforum are read or unread. If they are all read, mark the subforum as read for the user. Else, mark it as unread. But I think there must be another way.
Thank you in advance.
© Stack Overflow or respective owner