Displaying unread 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
BCVisin
Forum Newbie
Posts: 8
Joined: Fri Jun 11, 2004 4:39 pm

Displaying unread posts

Post by BCVisin »

Hi, I am creating a custom fourm for myself and I want to know how phpBB and vBulletin allow each user to see which fourms and topics they haven't read yet. I know that you can display the posts since last visist, but I want to know how to display unread posts, not the posts since last visit. Also, when a user signs up, I want them to have been marked as read all posts, so it is only the new posts after they log in. Any ideas?
User avatar
PrObLeM
Forum Contributor
Posts: 418
Joined: Sun Mar 07, 2004 2:30 pm
Location: Mesa, AZ
Contact:

Post by PrObLeM »

have it save when the last time was loged in then and when the last post was ...so if the the time on the last post is > than the last time loged in then they are new else they arent new

use time()...
BCVisin
Forum Newbie
Posts: 8
Joined: Fri Jun 11, 2004 4:39 pm

Post by BCVisin »

Ya, I fiured that one out, but when a user logs in and there are 10 new posts, and they view one of those new posts, then I want there to be 9 unread posts, and if they leave to go have dinner, or whatever, and come back an hour later, they can still see that they didn't read those 9 posts. It is not so much a question of posts since last visit, as it is a question of unread posts. Thanks for your reply!
penguinboy
Forum Contributor
Posts: 171
Joined: Thu Nov 07, 2002 11:25 am

Post by penguinboy »

I only see two options.
* In the post keep a log of user ids.
* In the user record keep a log of viewed posts.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

or just store the previous log in time (not page access time, actual login time) .. count a somewhat long period.. say 2 hrs or something, as a soft log out.
kettle_drum
DevNet Resident
Posts: 1150
Joined: Sun Jul 20, 2003 9:25 pm
Location: West Yorkshire, England

Post by kettle_drum »

It really is too much effort to store which posts each user has seen and not seen, as imagin on a big forum like this where there is like 100000 posts, you either have to store that 1000 users havent seen a post, or that 1000 users have seen a post. If you store this client side on a cookie, then this has to be sent back and forth all the time so the load time is huge, or if you store it server side you waste alot of space.

Its best as feyd said to just have like a 2 hour limit to show new posts, i.e. all posts from the time you came on the site, to 2 hours in the future are considered new - then you assume that the user has read them - or wasnt interested in them.
BCVisin
Forum Newbie
Posts: 8
Joined: Fri Jun 11, 2004 4:39 pm

Post by BCVisin »

but I have seen this done with outer forums like this. How is that done? Even if I change computers, I can still see which posts I have not read. There has to be a way...
Post Reply