Jump to content

Recommended Posts

Hi, I Hope I do have the right section for this!

 

I am currently working on a GWT Based AJAX Application with a PHP/MySQL backend.

One of the features I wish to add to my application is a forum for the users.

 

My query is to how forum systems such as phpBB, SMF, or vB implement the "unread topics/posts" feature.

EG: When I visit this forum and open a board such as this Application Design section, the forum knows which topics I have or have not read.

 

I was wondering how this was implemented?

 

The first thing that came to my mind was that every time a user opened a topic, a row was inserted into a db table that recorded the users id and topic id that could be checked against later.

But surely having a list of every topic the user has viewed and checking against it is a very unefficient method?

 

Is there another way to accomplish such a task?

 

Also, what would happen if a change was made to a topic, such as a new post? Would the forum need to loop through every record of every users visit to a topic and if the user has visited this topic remove the record so that it appears as unread to the user?

 

Any advice?

 

Thanks,

Andy

Link to comment
https://forums.phpfreaks.com/topic/183072-forum-posts-database-design/
Share on other sites

  • 3 months later...

The OP probably has the method right.  As far as efficiency is concerned you'll notice that the "unread topics" only lists 3 pages of topics, i.e. the current day's topics.  It doesn't list every topic ever posted.

 

There is probably a cron job to remove entries from this table every day at midnight or something.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.