Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

How does Vanilla remember your last read post?

edited February 2009 in Vanilla 1.0 Help
I've been trying to answer this question for a friend but can't figure it out with my limited knowledge of Vanilla's inner workings. Basically, throughout logins and deleted cookies, how does Vanilla remember that the last time I read a thread I left off at post 35 (#Item_35) and even though there's been 16 new posts (#Item_51), it will build the link to the earliest unread comment (#Item_36). I browsed through the database schema and the different tables and columns, but nothing really jumped out at me. Anyone that can explain this so I can understand just what's going on in the background there? Thank you!


  • Options
    There is a table in the database called UserDiscussionWatch which stores 4 things: The user ID, the discussion ID, the amount of comments there we in that discussion the last time the user visited it, and the date of when that happened. You will see that table is probably huuuuuuge :) That's how Vanilla remembers it all.
  • Options
    Ahhhh, I skipped that table thinking it was for users who flag discussions with something like the bookmark feature. Thanks :)
  • Options
    Just looked at the table, and it all makes sense now. Again, thanks.
  • Options
    If that table just grows with size (proportional to the product of the number of users and the number of posts - a square law - then perhaps Vanilla needs a process to truncate older records from that table? Vanilla could assume that any post older than N days has been read by the current user, and then it could truncate the table to N days for each user. I've implemented something similar on another forum, except that it kept track of the last M posts (default 200) in that way. Any post later than the last post in the list for a user was marked as 'not read' as soon as the user visit the forums (with the list immediately truncated down to 200 items). Any post older than the oldest item on the lists was assumed 'read'. For the 'not read' items on the list of 200, they were ticked off as they were read with a flip of its status. It worked well, never got itself confused, but the size of the data only increased in proportion to the number of users, not the product of users and posts. -- Jason
Sign In or Register to comment.