How does phpbb 3 determine unread posts in a thread?

Discussion forum for MOD Writers regarding MOD Development.
Locked
schwim
Registered User
Posts: 147
Joined: Sat Jun 04, 2005 8:03 am

How does phpbb 3 determine unread posts in a thread?

Post by schwim »

Hi there everyone!

I've got an unread posts block on an external page that uses phpbb 3 session integration. The block lacks unread/read post icons and I'd like to add them. I'm just not sure how phpbb 3 handles this.

Could someone give me a helping push with maybe with relevant session variables and mysql info that would help me on my quest to get unread icons working on my block?

Thanks very much for your time!
json
User avatar
Erik Frèrejean
Former Team Member
Posts: 9899
Joined: Tue Oct 09, 2007 9:09 am
Location: The Netherlands, 3.0.x Support Forum
Name: Erik Frèrejean
Contact:

Re: How does phpbb 3 determine unread posts in a thread?

Post by Erik Frèrejean »

Moving to MOD writers discussion.
Support Toolkit | Support Request Template | Knowledge Base | phpBB 3.0.x documentation
I don't give support via PM or IM! (all unsolicited pms will be trashed!)
User avatar
Brf
Support Team Member
Support Team Member
Posts: 53400
Joined: Tue May 10, 2005 7:47 pm
Location: {postrow.POSTER_FROM}
Contact:

Re: How does phpbb 3 determine unread posts in a thread?

Post by Brf »

Check the topics_track and forums_track tables to see if the post was made after the mark_time.
schwim
Registered User
Posts: 147
Joined: Sat Jun 04, 2005 8:03 am

Re: How does phpbb 3 determine unread posts in a thread?

Post by schwim »

Thanks very much for all your help. I finally managed to get it done :)
schwim
Registered User
Posts: 147
Joined: Sat Jun 04, 2005 8:03 am

Re: How does phpbb 3 determine unread posts in a thread?

Post by schwim »

Well, it seems that I spoke too soon.

Everything was working fine until I clicked the "Mark forums read" link. Now, all show as unread. I looked in the database and it seems clicking that link deleted all entries with my uid in forums_track and topics_track. The result is that all topics and forums show as read inside the forum and they all show as unread when looking at the block(since it can't find a record in the db for my uid and the topic #, it's assuming I haven't looked at the topic at all).

To add to the confusion, when I click the link and view the topic all the way to the final page, No entry is made for my uid and the topic.

Could someone explain to me

1) What Mark forums read link does?
2) Why the system isn't placing any records in the track tables after I clicked that link?
User avatar
Brf
Support Team Member
Support Team Member
Posts: 53400
Joined: Tue May 10, 2005 7:47 pm
Location: {postrow.POSTER_FROM}
Contact:

Re: How does phpbb 3 determine unread posts in a thread?

Post by Brf »

You also need to check user_lastmark in the users table.

The forums_track table records when you mark an individual forum read, while the topics_track keeps track of when you read a topic.
If no new posts have been made since your lastmark was set, there is no need to update the topics_track.

When you mark a forum as read, it deletes all of the topics_track for that forum. When you mark all of the forums read, it can also delete all of the forums_track records.
schwim
Registered User
Posts: 147
Joined: Sat Jun 04, 2005 8:03 am

Re: How does phpbb 3 determine unread posts in a thread?

Post by schwim »

Thanks very much for your help, brf. Unfortunately, I'm still having an issue.

After clearing the forums, New posts were posted. They show up. However, when I view a thread, it's not creating an entry even when the posts were made after I marked the forum as read. In fact, I posted in one and it now shows up as a new thread. Since I was there to make the post and it was made well after I cleared the forums, I would think that it would create an entry in topics_track but it's not.

An example:

my phpbb_users uid has
1352328643
as user_lastmark.

The thread I viewed and posted to has
1352330185
as topic_last_post_time

My user_lastmark is defintely less than the topic_last_post_time, so I would think that an entry would need to be made to the topics_track table when I visit the topic's last page, but it's not. I viewed the topic, posted to it and viewed it again and it's still not creating an entry in topics_track.

What am I missing?
schwim
Registered User
Posts: 147
Joined: Sat Jun 04, 2005 8:03 am

Re: How does phpbb 3 determine unread posts in a thread?

Post by schwim »

Just to be clear, when I view the thread's category in the forum system, it shows as read, so I'm not trying to say that the forum system is working incorrectly. It's definitely on my end, but I need to figure out why the forum system knows I've read that thread since it's last update when my lastmark is older than the thread's lastpost and there's no entry in either forums_track or topics_track for that tid and my uid.
schwim
Registered User
Posts: 147
Joined: Sat Jun 04, 2005 8:03 am

Re: How does phpbb 3 determine unread posts in a thread?

Post by schwim »

The issue was with me not properly applying the forum_tracks. It seems to be working as it should now.

Thanks for your help!
Locked

Return to “[3.0.x] MOD Writers Discussion”