Thudular Posted June 18, 2008 Share Posted June 18, 2008 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 Link to comment https://forums.phpfreaks.com/topic/110763-solved-i-am-making-a-forum-and-i-need-some-help-with-a-minute-detail/ Share on other sites More sharing options...
Jabop Posted June 18, 2008 Share Posted June 18, 2008 You'd have to create a separate table in your db for user views on threads, and posts Link to comment https://forums.phpfreaks.com/topic/110763-solved-i-am-making-a-forum-and-i-need-some-help-with-a-minute-detail/#findComment-568245 Share on other sites More sharing options...
Thudular Posted June 18, 2008 Author Share Posted June 18, 2008 Set up how? Each entry holding 1 view for a topic? Thats just seems excesive. What did you have in mind? Link to comment https://forums.phpfreaks.com/topic/110763-solved-i-am-making-a-forum-and-i-need-some-help-with-a-minute-detail/#findComment-568253 Share on other sites More sharing options...
PFMaBiSmAd Posted June 18, 2008 Share Posted June 18, 2008 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. Link to comment https://forums.phpfreaks.com/topic/110763-solved-i-am-making-a-forum-and-i-need-some-help-with-a-minute-detail/#findComment-568316 Share on other sites More sharing options...
PFMaBiSmAd Posted June 18, 2008 Share Posted June 18, 2008 Edit to the above: It was a different forum where I posted this, but the short-version posted above is the basis of how to do this. Link to comment https://forums.phpfreaks.com/topic/110763-solved-i-am-making-a-forum-and-i-need-some-help-with-a-minute-detail/#findComment-568332 Share on other sites More sharing options...
Thudular Posted June 18, 2008 Author Share Posted June 18, 2008 Thats quite a bit to get my head around. But if you stored the last viewed time, then got all posts newer than that, wouldn't it effectivly mark all posts before that as read? Link to comment https://forums.phpfreaks.com/topic/110763-solved-i-am-making-a-forum-and-i-need-some-help-with-a-minute-detail/#findComment-568357 Share on other sites More sharing options...
Thudular Posted June 18, 2008 Author Share Posted June 18, 2008 Oh I think i get it. Instead of adding views to a table, you add 'anti views', aka the topics you have not viewed. Then remove from the list as they are viewed. Thanks Link to comment https://forums.phpfreaks.com/topic/110763-solved-i-am-making-a-forum-and-i-need-some-help-with-a-minute-detail/#findComment-568379 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.