SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Evangelist Waffles's Avatar
    Join Date
    Nov 2005
    Posts
    435
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    New posts in a forum..

    Hey, I'm pondering on how to do this on my forums...new posts since last visit..

    I had one idea, which was a new table..say new_threads that has fields for

    user_id, thread_id and reply_id and read.

    Then when a user vists a thread/reply...a query is done to update this table, saying that that user has seen a given thread.

    I could then query all threads where that user hadn't visited, and get "new posts".

    This seems like a hell of a large table however...100 users..100 threads..100 replies... 100 * 100 * 100 = mucho large numbers over time.

    Is this the best way to accomplish the "new threads" feature?

    Thanks for any input. Hopefully I explained my idea clearly enough

  2. #2
    SitePoint Evangelist optl's Avatar
    Join Date
    Oct 2004
    Location
    Washington DC
    Posts
    415
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I would have a user table where last visit is stored. Then I would have a threads ands posts table. In the new post table there would obviously be a date column. Then everytime a visitor logs into your forum, you query all the posts that are newer than his last visit.
    Simple as that.
    For the phrase "Bethesda home architect", my clients
    websites occupy 6 of the first 8 results
    on the 1st page of Google. My Secret SEO Strategy Revealed

  3. #3
    SitePoint Evangelist Waffles's Avatar
    Join Date
    Nov 2005
    Posts
    435
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    My mind had traced over that solution but I was at an end working out how to get when they last visited? I mean I could log when they log in, but if the system (which it does) has a remember me option, this wouldn't apply. And not every user will logout. Perhaps something to do with a session?

  4. #4
    SitePoint Evangelist optl's Avatar
    Join Date
    Oct 2004
    Location
    Washington DC
    Posts
    415
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hmm, maybe another column called last_left where you log the time each user's session ended.
    For the phrase "Bethesda home architect", my clients
    websites occupy 6 of the first 8 results
    on the 1st page of Google. My Secret SEO Strategy Revealed

  5. #5
    SitePoint Evangelist Waffles's Avatar
    Join Date
    Nov 2005
    Posts
    435
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    That could work..but it would need something to activate the script? I'm thinking cron and I don't want to go down that route. Not yet anyway


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
  •