Jump to content

[SOLVED] I am making a forum, and I need some help with a minute detail


Thudular

Recommended Posts

Whether or not the user has viewed the topic :)

 

Now I know this is possible, but I can't think of a practical solution. So far the best I could come up with is storing a list of all the topics the user visits, then checking if said topic is on the list before displaying the image that indicates whether they have read the topic or not, which is not very practical when you think about how many topics the user might view.

Any ideas?

 

Thanks,

Thudular

I have written a couple of posts on this forum on now to handle viewed/unviewd topics/post. If you search you should be able to find them.

 

You cannot store "views" as this continually increases the amount of storage as the number of views or the number of members goes up.

 

Short version - You must store a "last viewed time" for each member that acts like a "book mark". Then when they visit again (or refresh a page), you copy the id's of all the posts/threads that are newer than the saved "last viewed time" for that member to a "unread" table (including the member's id) and then update that member's "last viewed time" to be the time of the latest post id that you copied to the "unread" table. If a post/thread id with that member's id matches a row in the "unread" table than you know they have not read that post/thread. To display all unread posts/threads, just query the table for rows matching that member's id. This will give you a result set with the id's of his "unread" posts/threads. Remove his matching row from the "unread" table when they view any post/thread. A "mark all threads as read" button would remove all rows that match that member's id.

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.