Nick G Posted January 4, 2007 Share Posted January 4, 2007 Hi everyone, I am new (not to PHP) but to this site.What I need help on and have been trying to figure out, is this:I'm creating a forum, it works and is coming along nicely. But what I want to know how to do is to create a system that will check to see what threads the user has seen and which ones he/she hasn't. AND if there is a new post in the thread it will show an icon that says (basically) New Post/Thread(s) or if it hasn't been viewed an icon that just says No New Posts/Threads. And once you do view that new thread or post, the icon changes to the viewed icon. If you need an idea on what I mean by this, look at pretty much any popular forum script (my main one is PHPbb).Example: http://www.phpbb.com/phpBB/If there is a new post(s) or new thread(s) in a topic/category it shows a circle with like an orange piece of paper in it, if there are no new posts or threads then it just shows a circle with plain piece of paper in it.There is even one on this forum (On the Forum Home, New Post, No New Post)I've searched and searched for help or a tutorial on this but no luck. Any help would be GREATLY appreciated. Quote Link to comment https://forums.phpfreaks.com/topic/32816-new-postsno-new-posts-script/ Share on other sites More sharing options...
ki Posted January 4, 2007 Share Posted January 4, 2007 Okay this is what I did for mine, but I havent implemented yet because im to lazy but it works, first you make a new mysql table, lets say `forum_new`, add all the fields like the username, topic id, forum id, and whatever else you want. Okay now thats all done, on the listing of the topics or forums for that matter is when your listing them check each one to see if itsnew or not. Now thats all done when a user is viewing the new topic you make a script all the way at the bottom and you make it delete new one. This should work, if you wanna get more technical about make a thread id row on your table. Quote Link to comment https://forums.phpfreaks.com/topic/32816-new-postsno-new-posts-script/#findComment-152833 Share on other sites More sharing options...
ToonMariner Posted January 4, 2007 Share Posted January 4, 2007 the easiest method woul dbe to use a cookie that stores a delimited string of all the threads the users has visited. simply explode that string and use array_keys() like so:[code]$ids = explode('|',$_COOKIE['threads']);if (array_keys($ids, $viewing_thread_id)){ // seen it.}else{ //mark New}[/code]this board probably uses something similar. If you choose not to have cookies then perhaps you could implement the same process in a database table. Quote Link to comment https://forums.phpfreaks.com/topic/32816-new-postsno-new-posts-script/#findComment-152845 Share on other sites More sharing options...
ki Posted January 4, 2007 Share Posted January 4, 2007 [quote author=ToonMariner link=topic=120957.msg496758#msg496758 date=1167911159]the easiest method woul dbe to use a cookie that stores a delimited string of all the threads the users has visited. simply explode that string and use array_keys() like so:[code]$ids = explode('|',$_COOKIE['threads']);if (array_keys($ids, $viewing_thread_id)){ // seen it.}else{ //mark New}[/code]this board probably uses something similar. If you choose not to have cookies then perhaps you could implement the same process in a database table.[/quote]nah this board doesnt use cookies, or i think any board at that matter uses cookies, it uses mysql like the other boards. my explanation is all you need to achieve this. Quote Link to comment https://forums.phpfreaks.com/topic/32816-new-postsno-new-posts-script/#findComment-152939 Share on other sites More sharing options...
Nick G Posted January 4, 2007 Author Share Posted January 4, 2007 Well, I do like the cookie idea more cause I don't want to have to take up a bunch of space in my MySQL for forums_viewed. But I also don't know whether or not Cookies would be good, cause some people turn cookies off and my host may very well have them disabled as well (I also have not used cookies very much). A little more insight to both of your scripts would be great. Quote Link to comment https://forums.phpfreaks.com/topic/32816-new-postsno-new-posts-script/#findComment-153113 Share on other sites More sharing options...
ki Posted January 5, 2007 Share Posted January 5, 2007 What you could do, ive seen this on some forums, is put time for another field in `forum_new` and make each page check if its been over a certain period of time that the person hasnt looked at it and make it delete it. Quote Link to comment https://forums.phpfreaks.com/topic/32816-new-postsno-new-posts-script/#findComment-153275 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.