Simple Machines Community Forum

Customizing SMF => SMF Coding Discussion => Aiheen aloitti: tbk22 - syyskuu 28, 2013, 09:45:24 AP

Otsikko: SMF recent posts system? How does it work?
Kirjoitti: tbk22 - syyskuu 28, 2013, 09:45:24 AP
Basically I want to know how does the recent posts on a viewed topic feature works, like when you click  the new icon on a post and it takes you to the last post you haven't seen on that thread and the url adds this to the end ;topicseen#new

This some brainstorming I am doing with a friend on how some features  on forums work. He told me it was only possible with these methods

Lainaa1. storing thread viewing history in your browser session
2. comparing a timestamp of your last visit to the activity in each thread
3. a combination of the two above


However I think that is too much resource consuming and these feature should be much more straightforward the way it is currently implemented in SMF, so how does it work?
Otsikko: Re: SMF recent posts system? How does it work?
Kirjoitti: Arantor - syyskuu 28, 2013, 10:32:49 AP
When you visit a topic, the id of the last message that you've seen is stored. So if you view the first page of a two page thread, the id of the last message on the first page is stored.

Additionally, under some circumstances it will not have the above, it will have a single record for the highest post id you've seen for an entire board. Whichever of the two it finds that is higher is the record of the last read post.

This is stored per user and for large forums can become very large indeed if there are a lot of people as well as a lot of topics.
Otsikko: Re: SMF recent posts system? How does it work?
Kirjoitti: tbk22 - syyskuu 28, 2013, 12:27:52 IP
Lainaus käyttäjältä: Arantor - syyskuu 28, 2013, 10:32:49 AP
When you visit a topic, the id of the last message that you've seen is stored. So if you view the first page of a two page thread, the id of the last message on the first page is stored.

Additionally, under some circumstances it will not have the above, it will have a single record for the highest post id you've seen for an entire board. Whichever of the two it finds that is higher is the record of the last read post.

This is stored per user and for large forums can become very large indeed if there are a lot of people as well as a lot of topics.

Thanks a lot for the answers...

So it is stored per user and per topic for each user am I right?
Otsikko: Re: SMF recent posts system? How does it work?
Kirjoitti: Arantor - syyskuu 28, 2013, 12:33:32 IP
Yes, it is mostly per user, per topic, with some cases of it being per *board* and purging the per topic storage.