Forum Question: New Posts?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
krak3n
Forum Newbie
Posts: 6
Joined: Fri Oct 22, 2004 6:14 pm

Forum Question: New Posts?

Post by krak3n »

Hi guys

im wondering if you can help me out with a little dilema im having. Im building a customised forum for a project im currently working on. I cant seem to get my head around how the 'New Posts' feature operates on forums such as this phpbb based one.

I have 2 timestamps. 1 which is the users last logged in time, so whenever a user logs in via the auto login function or logging in via the login form. The other stamp being whenever a page is refreshed by the user. Ive managed to get as far as showing new threads for a user since their last logged in date but then I hit a brick wall. What ive noticed on forums such as these is when you view a new post and then go back to the thread or category listings the new posts icon is no longer present and the thread or category dosnt show it as it having a new post to it. Thats what im having quite a bit of trouble with and can't quite seem to get my head around it.

I hope ive made sense.

Thanks for any help you guys can offer :)

krak3n
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

phpbb in 2.0.x versions at least, stores each thread id they visit (that's new) in a cookie.

In Olympus (phpBB 3) this has been moved to the database, so it's more accurate, along with being able to grow to a rather large number of threads being marked as read. Whenever the user logs out, or their session id is deleted, so are all the "read markers" associated with them
krak3n
Forum Newbie
Posts: 6
Joined: Fri Oct 22, 2004 6:14 pm

Post by krak3n »

ok, thanks :)
I will have a play around. I felt that storing in the database might be a little in efficient but if thats how the new phpBB systems gonna work then i guess wats good for them is good for me too :P
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

I know that if I don't completely close down my browser, or remove their session cookies every few days, I'll start getting a small error which leaves threads left unmarked.. This is due to the size limitation of cookies on a user's machine. So yes, it may be marginally inefficient, but for users who stay connected for extremely long periods of time, it's very helpful.

If done right, it only adds a small fraction of time to an existing query you'll need to do anyways (retrieve their session information)
Post Reply