I am writing a forum from scratch as a personal project, and just one of those "to see if I can do it" things. I don't really expect it to be used as a real forum, but several of my friends and I will be using it. I suppose one day if it's solid enough, I would actually try to get people to join.
My question is this: Is there an efficient/easy way to keep track of new posts and if an user has viewed them.
It seems to me it's certainly doable, but it would create an incredible strain on the database (the forum is backed by a MySQL database). Basically you would have to track every post for every user, and in the case of a popular forum with many users and may posts, this obviously causes some issues.
So I am wondering how to do it efficiently. I can rationalize how to check if a thread has a NEW post, but once I view that thread, I want to be able to look at the list of threads and see that one particular thread is marked as "no new posts". And, to take it a step further (since I've seen this in other forums), it would track threads with multiple pages. For example, if a thread had three pages, and I only viewed the first page, the thread would still be listed as having new posts.
I don't want to take the easy (and less accurate) way out and compare post times versus last login time, because that doesn't truly keep track. I can narrow it down to certain sections (the last time the user visited a section, compare that time to post times), but again, it doesn't truly keep track of new posts.
I suppose what's really bugging me about this is not the PHP code (I apologize if this is in the wrong section or not appropriate), but more so the logic behind it. If anyone can offer their expertise or suggestions, I would greatly appreciate it. Thank you for your time.
(By the way, this site is an excellent resource - I can't believe I haven't come here before)