Page 1 of 1
Creating a Forum: View new posts?
Posted: Sat Jan 31, 2009 7:11 pm
by zeve
Hey guys,
I have created a forum.
The db structure is like this
1 table of subcategories (ie general, coding, marketplace, etc)
1 table of topics
and 1 table of replies
I want each individual user to be able to hit a "view new posts" button to see posts that they havent seen yet, similar to what we have here on devnetwork.
How can something like this be achieved? What is the best route and method to do something like this?
Re: Creating a Forum: View new posts?
Posted: Sat Jan 31, 2009 7:30 pm
by s.dot
PHPBB uses cookies for this.
Probably something along the lines of storing post ID's that have been viewed, then querying for posts that are new and not in this list from the cookie.
Re: Creating a Forum: View new posts?
Posted: Mon Feb 02, 2009 1:59 pm
by zeve
Do i need to create an array in the cookie?
Isnt there a limit on how big a cookie can be? If a user views 100 posts, wont it start being excessive?
Re: Creating a Forum: View new posts?
Posted: Tue Feb 03, 2009 8:58 am
by webaddict
zeve wrote:Isnt there a limit on how big a cookie can be? If a user views 100 posts, wont it start being excessive?
There is a limit, although I'm not certain what the limit is, exactly. I know that some forums will treat every post that has a reply which is older than two weeks as "read" by default, and only classify the others as unread. Although it's not exactly "read", this will assure some performance. Other than that, it's just the question of where you store the info: in the database or in a cookie. You might want to do both: if the cookie is stale (too old) or not present, you can generate a new list of unread topics. Let me know how this turns out, as I might have to implement this myself soon, too.
Re: Creating a Forum: View new posts?
Posted: Fri Feb 06, 2009 10:12 am
by zeve
I've thought of an issue with using cookies...
What if they use a different computer???
Re: Creating a Forum: View new posts?
Posted: Fri Feb 06, 2009 11:43 am
by Theory?
Then store it in the session and persist the session to the DB after each visit.
Re: Creating a Forum: View new posts?
Posted: Sat Feb 07, 2009 7:42 pm
by josh
You only need to track viewed forums during the session. After the session ends you prune out 1,000s of forums you don't have to check, since their last_posted_in timestamp < session_began_timestamp