SitePoint Sponsor

User Tag List

Page 1 of 2 12 LastLast
Results 1 to 25 of 31

Hybrid View

  1. #1
    Non-Member
    Join Date
    Nov 2003
    Location
    here
    Posts
    258
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Forum Development (New posts?)

    What is the best way to track whether a topic has new posts that a user has not read. Most mainstream forums do it and display icons depending on whether a user has read a topic or whether the topic has new posts the user hasn't seen yet. I can't figure out how you could do that :P

  2. #2
    Non-Member
    Join Date
    Nov 2003
    Location
    here
    Posts
    258
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ?

  3. #3
    Non-Member
    Join Date
    Nov 2003
    Location
    here
    Posts
    258
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ????????????????????????!?!?!!?!?!?!?!

  4. #4
    Non-Member
    Join Date
    Nov 2003
    Location
    here
    Posts
    258
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    please help? i dont think its a hard question im sure someone knows ;p

  5. #5
    SitePoint Enthusiast
    Join Date
    Apr 2005
    Posts
    58
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If you go into the user control panel (under "My Sitepoint" in the menu bar just beneath the forums bar at the top of the page), and then go into options, you'll find the "Thread Subscriptions" option:

    When you post a new thread, or reply to a topic, you can choose to automatically add that thread to your list of subscribed threads, with the option to receive email notification of new replies to that thread.

    You can then log into your cpanel/subscriptions to follow threads - or just wait for email notifications to be sent to you (if you choose the email setting).

    As for threads you haven't read, I'm not sure if there are any highlighting options for those beyond the default settings.

    Hope that helps.

  6. #6
    He's No Good To Me Dead silver trophybronze trophy stymiee's Avatar
    Join Date
    Feb 2003
    Location
    Slave I
    Posts
    23,449
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    1) Bumping threads is against forum rules

    2) You need to give people more then one hour to answer you. We're not at your beck and call.

    3) K0ng answerred your question perfectly.

  7. #7
    Non-Member
    Join Date
    Nov 2003
    Location
    here
    Posts
    258
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Not what I was thinking but thanks. Sorry stymiee but its a simple question and im in a rush here! And no he didnt really answer my question.

    I mean when you view the forum list, on lets say, phpBB. if there are no unread topics you see this image:



    On the other hand, if there ARE unread topics you get this image.



    It has nothing to do with subscriptions, somehow it knows if there are new topics since you last viewed a particular forum, I just can't see how it does that at all.

    It even knows if a topic has any new POSTS in it since you last viewed that topic. For example:

    No new posts:

    New posts:


    Perhaps they log when someone last viewed a forum/topic and then calculate if the date of a topic/post is newer than that value and then show the appropriate picture?

  8. #8
    Non-Member
    Join Date
    Nov 2003
    Location
    here
    Posts
    258
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ?????????????????!?!?!

  9. #9
    SitePoint Evangelist dmsuperman's Avatar
    Join Date
    Feb 2005
    Location
    A box
    Posts
    516
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    So you're asking how to code this?
    I would suggest storing what users have viewed the thread in the thread's row in the database, then when you go to it split them up and if your user is in the array, it is old, otherwise it's new and then when viewing the thread add your user to the array. Then when new posts are added clear all the users.
    <(^.^<) \(^.^\) (^.^) (/^.^)/ (>^.^)>
    Core 2 Duo E8400 clocked @ 3.375GHz, 2x2GB 800MHz DDR2 RAM
    5x SATA drives totalling 2.5TB, 7900GS KO, 6600GT

  10. #10
    He's No Good To Me Dead silver trophybronze trophy stymiee's Avatar
    Join Date
    Feb 2003
    Location
    Slave I
    Posts
    23,449
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    Cristiano, stop bumping this thread. I've already warned you that this is against the rules. Now I'm not asking you nicely.

  11. #11
    Non-Member
    Join Date
    Nov 2003
    Location
    here
    Posts
    258
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Stymiee get a life

    Thanks for the suggestion dmsuperman.

    That seems like a slightly heavy handed way of doing it though, I think I've arrived at a sensible solution, in that I'm going to log the last time a user visited the forum, and then deduce whether a topic/post was created since they last visited.

    Thanks for the help. Well not really much help but thanks for making me go through the processes in my own mind and work out a solution.

  12. #12
    SitePoint Wizard Dylan B's Avatar
    Join Date
    Jul 2004
    Location
    NYC
    Posts
    1,150
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Cristiano
    Stymiee get a life
    Dude, just follow the damn rules.

  13. #13
    Non-Member
    Join Date
    Nov 2003
    Location
    here
    Posts
    258
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Dylannn
    Dude, just follow the damn rules.
    Take a chill pill, man! Maybe if you took a second to help I wouldn't have to bump the thread

  14. #14
    $this->toCD-R(LP); vinyl-junkie's Avatar
    Join Date
    Dec 2003
    Location
    Federal Way, Washington (USA)
    Posts
    1,526
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Cristiano
    Maybe if you took a second to help I wouldn't have to bump the thread
    You don't have to bump a thread at all to get a response around here. You do however need to have some patience and trust that someone will eventually answer your questions.

    You have to understand too that there is far less activity in the forums on the weekend than there is during the week. Weekend or not though, expecting an answer within an hour is unrealistic.
    Music Around The World - Collecting tips, trade
    and want lists, album reviews, & more
    Showcase your music collection on the Web

  15. #15
    SitePoint Zealot
    Join Date
    Feb 2005
    Posts
    134
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Perhaps the easiest way is using cookies

  16. #16
    SitePoint Guru
    Join Date
    Nov 2004
    Location
    Plano
    Posts
    643
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    just because a user has visited a forum does not mean they have viewed all the threads

    i find dmsuperman's method a good way to do it, i would do it if i was in the same position you are

  17. #17
    Non-Member
    Join Date
    Nov 2003
    Location
    here
    Posts
    258
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    What happens if you've got hundreds of people viewing a thread, you are going to have hundreds of values in one field is that efficient?

  18. #18
    Non-Member
    Join Date
    Nov 2003
    Location
    here
    Posts
    258
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Cookies are evil, superuser.

  19. #19
    SitePoint Wizard
    Join Date
    May 2003
    Location
    Berlin, Germany
    Posts
    1,829
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    By the way, thread author, have you investigated how phpBB and/or IPB or other forum software packs do it? You should do that before asking this here.

    Also a simple google search turned up nice results for me too...

  20. #20
    SitePoint Enthusiast
    Join Date
    Oct 2004
    Location
    Sweden
    Posts
    49
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    dmsuperman: I like your idé of doing this, thanks
    Saywoot.net - Online Comic!

  21. #21
    Non-Member
    Join Date
    Nov 2003
    Location
    here
    Posts
    258
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    What did you search for on google?

    I am not sure how the mainstream forums do it, and I don't have the binaries to investigate their code, nor the patience to download them all and go trawling through their bulky code

  22. #22
    Non-Member
    Join Date
    Nov 2003
    Location
    here
    Posts
    258
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I've come up with a new, much simpler theory which avoids complex arrays or cookies etc.

    New table called topic_views - each time a user visits a topic, it either creates a new row in topic_views logging their view or updates the time field in topic_views if an existing row exists for that topic and that user. You simply log the user_id, topic_id, and view time.

    This way you can easily check whether a topic has been viewed by a user, or whether any new posts have been made to a topic since a user last viewed them. You can also check if an entire forum has any new posts in it that the user hasn't viewed. All it takes is some clever querying and I think this method can be extremely effective and most importantly, efficient.

    I'm going to write this code up now.

  23. #23
    SitePoint Addict fesh's Avatar
    Join Date
    Jan 2005
    Location
    Jackson, New Jersey
    Posts
    218
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    why don't you just create a field in the database that stores an array of who has read the forums.

    everytime someone posts, it should empty the array...

    I don't think it's that hard...
    Fesh
    imagine what it's going to be like

  24. #24
    Non-Member
    Join Date
    Nov 2003
    Location
    here
    Posts
    258
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It goes against my principles, I just don't like doing it that way. I've already translated my theory to code and I can assure you it works. All that looping through arrays, exploding etc. is a bit of a headache when you can just do one simple query, no?

  25. #25
    Non-Member
    Join Date
    Nov 2003
    Location
    here
    Posts
    258
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I've finished coding this system and I think it works superbly .

    This is my method for displaying a topic image, one for a topic with new posts and one for a topic with no new posts, as you can see its very clean and avoids looping through potentially long and difficult to sort arrays.

    PHP Code:
    function topicImage($topic_id) {

    global 
    $database$session// Set access to class objects

    // Get last view information for the topic
    $last_view_info $this->getLastTopicView($topic_id$session->username);

    // Get last post information for the topic
    $last_post_info $this->getLastPosterInfo($topic_id);

    // Work out whether there are new posts in the topic
    if ($last_view_info == || $last_post_info["post_time"] > $last_view_info["view_time"]) {
    $image "<img src=\"images/f_norm.gif\">";
    } else if (
    $last_post_info["post_time"] < $last_view_info["view_time"]) {
    $image "<img src=\"images/f_norm_no.gif\">";
    }

    return 
    $image;

    // End topicImage() 


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •