aj123cd Posted August 30, 2012 Share Posted August 30, 2012 Show new replies to your posts. I am building web forum in php. I am now stuck in the ?Show new replies to your posts? part. I am not able to understand the mechanism of Show new replies to posts. Can anyone explain to me how Show new replies to your posts Work? What kind of filter system should I have used? Please can you advise me? Thank you for your help. Link to comment https://forums.phpfreaks.com/topic/267795-show-new-replies-to-your-posts/ Share on other sites More sharing options...
Christian F. Posted August 30, 2012 Share Posted August 30, 2012 Use the timestamps of the last login time. Then you just retrieve all replies with a newer timestamp, and which belongs to a thread in which the user have replied. Quite easily done with a simple JOIN statement, or even a subquery. Depending upon your database design, of course. Link to comment https://forums.phpfreaks.com/topic/267795-show-new-replies-to-your-posts/#findComment-1373938 Share on other sites More sharing options...
Jessica Posted August 30, 2012 Share Posted August 30, 2012 Use the timestamps of the last login time. Then you just retrieve all replies with a newer timestamp, and which belongs to a thread in which the user have replied. Quite easily done with a simple JOIN statement, or even a subquery. Depending upon your database design, of course. There's a bit more to it if you want it to work past one refresh. For example, this forum - when you load the new replies page, it shows you the unread ones. Once you view one of them, the rest are still there to view. Link to comment https://forums.phpfreaks.com/topic/267795-show-new-replies-to-your-posts/#findComment-1373939 Share on other sites More sharing options...
Mahngiel Posted August 30, 2012 Share Posted August 30, 2012 you'll need to implement a tracking table. it can be very simple: user_id | thread_id | timestamp for every thread a user visits, they get logged with a timestamp. compare a thread_id with a last_post_timestamp to see if there is a greater time. if not, it's not new. Link to comment https://forums.phpfreaks.com/topic/267795-show-new-replies-to-your-posts/#findComment-1373950 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.