On some websites or forums I usually go to, entries that I havn’t read yet are marked as ‘new’. I would like to implement this feature on a website I have developed (with news being posted from time to time) — php/mySQL. How is this usually done ? Does it require using a cookie remembering the last visit date/time ? Or the last viewed posts/urls ? How can I identify the users ?
Share
Cookies are just one possible way of identifying the user for the session, or between visits for those without authentication. Though a very common and useful way. (PHP can also use the sid or another parameter, though its not common anymore.)
You need to store either which threads/posts the user have read, or which he/she has not. You can sum things up with read everything before ‘date’ or postId for certain subforums.
This all depends on the lay out of your forums, posts and news, and how dynamic they are. You might also only want to show new posts since last visit, show new posts while the user is currently at your site, then use the new posts since last visit if the user is away for more then a predefined (x hours)/calculated (y hours if weekend, z hours if admin) time.
Edit: CSS for visited links will not help you with new comments for news, new posts in a thread, go directly to the first unread post or accessing the site at work/school and home.