LanceT Posted January 28, 2011 Share Posted January 28, 2011 How do forums check if you've read a post or not? Is it through cookies? Quote Link to comment https://forums.phpfreaks.com/topic/225937-how-do-forums-check-if-youve-read-a-post-or-not/ Share on other sites More sharing options...
doddsey_65 Posted January 28, 2011 Share Posted January 28, 2011 im sure some forums differ in their methods but yes cookies is one option and the logical one. Quote Link to comment https://forums.phpfreaks.com/topic/225937-how-do-forums-check-if-youve-read-a-post-or-not/#findComment-1166447 Share on other sites More sharing options...
ignace Posted January 28, 2011 Share Posted January 28, 2011 How do forums check if you've read a post or not? Is it through cookies? A forum marks a post read when you opened it. Quote Link to comment https://forums.phpfreaks.com/topic/225937-how-do-forums-check-if-youve-read-a-post-or-not/#findComment-1166580 Share on other sites More sharing options...
l4nc3r Posted January 28, 2011 Share Posted January 28, 2011 Cookies is one way. I'd prefer to store the "reads" in a database so I have access to that kind of data and if the user decides to clear his/her cookies, nothing is affected. Quote Link to comment https://forums.phpfreaks.com/topic/225937-how-do-forums-check-if-youve-read-a-post-or-not/#findComment-1166691 Share on other sites More sharing options...
ignace Posted January 28, 2011 Share Posted January 28, 2011 if the user decides to clear his/her cookies, nothing is affected. Indeed. I should have pointed out that I was referring to storing the data in a database in my post. Quote Link to comment https://forums.phpfreaks.com/topic/225937-how-do-forums-check-if-youve-read-a-post-or-not/#findComment-1166721 Share on other sites More sharing options...
salathe Posted January 28, 2011 Share Posted January 28, 2011 How do forums check if you've read a post or not? Is it through cookies? PHPFreaks uses an army of insects, looking over your shoulder to see which posts you're reading, who then report back to the forum server via your wifi (or tapping into your modem directly). Sometimes they eat cookies, if the cookie jar is left open… they've got to eat something! Quote Link to comment https://forums.phpfreaks.com/topic/225937-how-do-forums-check-if-youve-read-a-post-or-not/#findComment-1166730 Share on other sites More sharing options...
jcbones Posted January 28, 2011 Share Posted January 28, 2011 I use a magik marker to check off the ones I've read. Screen gets a little cluttered. Quote Link to comment https://forums.phpfreaks.com/topic/225937-how-do-forums-check-if-youve-read-a-post-or-not/#findComment-1166746 Share on other sites More sharing options...
Danny620 Posted January 28, 2011 Share Posted January 28, 2011 too do this you would create a colume in the database like read with data type of int and you would simply do a qury like Selete post_comment FROM posts WHERE read = 1 that would then display all posts that have been read and same gos for WHERE read = 0 Quote Link to comment https://forums.phpfreaks.com/topic/225937-how-do-forums-check-if-youve-read-a-post-or-not/#findComment-1166752 Share on other sites More sharing options...
LanceT Posted January 29, 2011 Author Share Posted January 29, 2011 But there's thousands of users with thousands of posts, so I'm wondering how you store this data in the database efficiently. One way I thought of is to insert a new row into a table whenever a user has read a post for the first time, but then this could potentially have millions and thousands of rows and seems to be inefficient IMO. What's a way to do this better? Quote Link to comment https://forums.phpfreaks.com/topic/225937-how-do-forums-check-if-youve-read-a-post-or-not/#findComment-1166786 Share on other sites More sharing options...
doddsey_65 Posted January 29, 2011 Share Posted January 29, 2011 i think people have been getting confused by what you meant. am i to understand you want to check if a registered user has read a post(something that they chose to be notified about or are following) like when phpfreaks shows you new replies to your posts, then once you have read them the links dissapear. if so then cookies is the way to go. Quote Link to comment https://forums.phpfreaks.com/topic/225937-how-do-forums-check-if-youve-read-a-post-or-not/#findComment-1166890 Share on other sites More sharing options...
LanceT Posted January 29, 2011 Author Share Posted January 29, 2011 i think people have been getting confused by what you meant. am i to understand you want to check if a registered user has read a post(something that they chose to be notified about or are following) like when phpfreaks shows you new replies to your posts, then once you have read them the links dissapear. if so then cookies is the way to go. Yes like on these forums, when you go to a page like http://www.phpfreaks.com/forums/php-coding-help/ You can see that some threads have "new" written on the side of them with orange background. I just wanted to figure out how the forum decided to show which ones were new and which ones were not new. And if you say its through cookies, won't that possibly mean that the forum is going to set a ton of cookies? Quote Link to comment https://forums.phpfreaks.com/topic/225937-how-do-forums-check-if-youve-read-a-post-or-not/#findComment-1166908 Share on other sites More sharing options...
doddsey_65 Posted January 29, 2011 Share Posted January 29, 2011 without having access to the SMF(software phpfreaks uses) database its hard to figure out. the cookie names generated by SMF arent clear about what they are but theres only about 4 or 5 of them so i dont think its cookies. Quote Link to comment https://forums.phpfreaks.com/topic/225937-how-do-forums-check-if-youve-read-a-post-or-not/#findComment-1166910 Share on other sites More sharing options...
ignace Posted January 29, 2011 Share Posted January 29, 2011 Sometimes they eat cookies, if the cookie jar is left open… they've got to eat something! I noticed, so I accidentally closed the jar... missing some insects? Quote Link to comment https://forums.phpfreaks.com/topic/225937-how-do-forums-check-if-youve-read-a-post-or-not/#findComment-1166911 Share on other sites More sharing options...
ignace Posted January 29, 2011 Share Posted January 29, 2011 too do this you would create a colume in the database like read with data type of int and you would simply do a qury like Selete post_comment FROM posts WHERE read = 1 that would then display all posts that have been read and same gos for WHERE read = 0 I wouldn't hold the column in the posts table otherwise it will be flagged read for every user once one opens it. Quote Link to comment https://forums.phpfreaks.com/topic/225937-how-do-forums-check-if-youve-read-a-post-or-not/#findComment-1166912 Share on other sites More sharing options...
ignace Posted January 29, 2011 Share Posted January 29, 2011 i think people have been getting confused by what you meant. am i to understand you want to check if a registered user has read a post(something that they chose to be notified about or are following) like when phpfreaks shows you new replies to your posts, then once you have read them the links dissapear. if so then cookies is the way to go. And then I close my browser*... all posts marked unread.. darn, I'll have to start all over again (*) I have my browser set to destroy any and all cookies regardless of expiration date. Quote Link to comment https://forums.phpfreaks.com/topic/225937-how-do-forums-check-if-youve-read-a-post-or-not/#findComment-1166913 Share on other sites More sharing options...
PFMaBiSmAd Posted January 29, 2011 Share Posted January 29, 2011 It would be impossible to keep a list of ALL the posts viewed or not-viewed (depending on if you are a optimist or a pessimist) for each member. This is done by keeping a 'bookmark' (imagine that you are reading a book where pages (posts) are constantly being added to the end of the book) of the highest post id where the member has previously viewed all the posts up to that point and displaying the 'new' icon for posts that are greater than that bookmarked post id that have not been viewed yet. You only need to keep a smaller database table of the 'viewed' posts that have an id greater than the bookmarked post id. As new posts are viewed, their id is added to the table and the 'new' icon is not displayed for them. I'll leave the logic of when you advance the bookmark and clear entries out of the smaller table up to you (I wish SMF had gotten it right in all situations.) Quote Link to comment https://forums.phpfreaks.com/topic/225937-how-do-forums-check-if-youve-read-a-post-or-not/#findComment-1166914 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.