• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Forum system - how to track already read vs new messages, per user

#10
[eluser]TheFuzzy0ne[/eluser]
To expand on my suggestion, to implement a "mark all forums/threads as read", your script would simply do the following:

If a user is marking all forums as read, delete all tracking rows belonging to that user, and insert one row containing marking the most recent post as read. This will mean that only posts that are dated after the date of that row, will show as unread.

If the user is marking all forums as being read in a specific forum - delete all rows for the user with the specified forum id, and insert one row which links to the most recent post in that forum.

Now one thing I overlooked here, is that you'll need to store the forum ID in this table too, then you can work with only the data for any particular forum (or all forums if you wish).

Pruning can be done with each request. Simply order the rows by date, and get the date for row number 250 if it exists (or however many rows you gave to the user), and delete all rows pertaining to that user where the date is older than the selected row. With this method, you won't have any empty rows for the user, and you don't have to earmark any rows when the user is created, so if the account is created but never used, no rows are used. If the user only reads 5 forum posts and never uses the account again, you will only have 5 rows in the table for them (which of course can be cleaned with another periodic process, that removes entries that are say, more than 30 days old.

It sounds simple enough (in theory), and comes at the cost of a few extra database queries per forum request, but I've heard that some/most mainstream forums make in excess of 30 database queries per request (although it would be great if anyone actually has some figures on this).

I hope this makes sense. What I would like to know, however, is the name of any libraries already in existence that do this for you.


Messages In This Thread
Forum system - how to track already read vs new messages, per user - by El Forum - 04-01-2009, 05:52 AM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.