Jump to content

Implementing a read/unread feature on my forum


jgd12345

Recommended Posts

Hi, i'm in the process of building my own small forum.  One of the features i feel i can't live without is displaying the read/unread posts icon next to each topic.  I thought of a couple ways of doing this but none seem good enough:

 

1. Create a table in my database to store the topic id and the user id for each topic a user views.  This will easily allow me to detect whether a user has viewed a topic.  However this could lead to a potentially massive table.

 

2. Create a cookie for each post a user views but again this could create to too many cookies.

 

As you can see neither of my ideas seem to work.  Really appreciate it if someone could suggest an alternative.

I'd agree with Johnsen. Then you can make a simple check of the database to see which ones have been read.

The problem with cookies is they can be deleted.. then all of the posts will look unread to the user.

 

Another method with a database may be to have an extra column in the posts table which contains a list of all the user id's which have viewed that post, separated by a symbol or even a ','. Although then you'd have to explode the results and search it. Separate table would probably be best!

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.