I am in the process of writing my own basic forum to plug into a code igntier site. I’m a little stuck on how to display threads/latest posts unread by a user.
I was thinking of a table that holds each thread_id visited, but this table has the potential to get rather large.
What’s are some ways to approach this requirement?
A simple idea: record the last datetime that a user visits the site/forum/subforum. This could be as granular as the thread or subforum, as you like. Perhaps create/update this key-value pair of
thread_idandlast_visit_datein a cookie. Perhaps store this in a cookie, rather than in your RDBMS. Ask: is this mission critical data, or an important feature that can/cannot withstand a loss of data?When the user returns, find all the threads/posts whose
create_dateis greater than thelast_visit_datefor the forum.I’m assuming that the act of visiting the forum (list of threads) is same as ‘viewing’. Assuming that if the info was presented, that you’d ‘viewed’ the thread title, regardless of whether you actually drilled into the thread.