Jump to content

help wanted: subscription, read/unread, new posts feature for custom forum

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
7 replies to this topic

#1
MichaelR

MichaelR

    Newbie

  • Members
  • PipPip
  • 13 posts
Hello,

I've created my own forum and everything is going very well but some have suggested a feature to subscribe to threads, and then they can have a notification for when a new post is made in that thread. Also some have wanted a way to distinguish threads they have thread from those they haven't and those who have new unread posts. But currently I'm stuck and I'm not sure how I could go about this without having to do a billion MySQL queries.

Any help would be greatly appreciated! :)

#2
Brandon W

Brandon W

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 4,828 posts
SQL would be the quickest way to do it. But we need to know the logic behind your forum so we can understand it to do the code.

Or we can tell you how to do it?
jQuery Selectors Tutorial - jQuery Striped Table tutorial - jQuery Events - jQuery Validation

Sorry if I don't post as often as I did, I'll try to get here as much as possible! I'm working my bum off to get this scholarship and other stuff!


#3
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
Clever use of count and distinct can get you a lot of that information as part of a single query.
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

#4
MichaelR

MichaelR

    Newbie

  • Members
  • PipPip
  • 13 posts

Brandon W said:

SQL would be the quickest way to do it. But we need to know the logic behind your forum so we can understand it to do the code.

Or we can tell you how to do it?

Well to put it short, there are 7 tables in a database named "club." They are: categories, forums, threads, posts, invite codes, members, and members online.

Whenever someone creates a new thread it inserts the title, author, forum id, and date into the thread table and then inserts the author, post, thread id, forum id, and date into the post table. And when someone posts a reply it will do the same as creating a new thread, by inserting into the post table, and increasing the replies count by 1 for that specific thread in the thread table.

So I'd need some way for after someone makes a post I can show the user there is a new post. I'm thinking making "no new posts" threads in italics, "new posts" threads in bold, and then threads they haven't read in just regular text, but I'm not sure how I should go about keeping track of everything. :confused:

If you need any other information I'll be glad to give it.

#5
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
Most forums, like this one, also keep track of the last time you read each thread (say within the last month) and compare that against the most recent post in each thread.
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

#6
MichaelR

MichaelR

    Newbie

  • Members
  • PipPip
  • 13 posts

WingedPanther said:

Most forums, like this one, also keep track of the last time you read each thread (say within the last month) and compare that against the most recent post in each thread.
So I should create a new table? One that has an id, member_id, thread_id, last_visit? But then on the view forum page that would be a lot of queries wouldn't it? Because I'd have to do one per thread.

#7
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
The key to keeping the queries down is to use joins. You can query the threads with a join to last post read. Then compare the results to the last login date/time and display anything with a null last read or newer post than last login as a new item.
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

#8
Guest_Jordan_*

Guest_Jordan_*
  • Guests
Also, vBulletin (this forum software) stores this data in serialized form in the database.