Update forum unread status

Discussion forum for MOD Writers regarding MOD Development.
Locked
EAnushan
Registered User
Posts: 17
Joined: Fri Aug 15, 2008 1:53 pm

Update forum unread status

Post by EAnushan »

I've been doing a few modifications so I can pull posts from my forum into my website. I have a page that lists topics in a particular forum and displays the text "Unread" beside them if the article hasn't been read before. Everything is working as expected except that when I click on one of the topics, it marks the topic as read, but leaves the forum it's in as unread.

Code: Select all

//mark read
     		$forum_id	= request_var('f', 0);
			$topic_id	= request_var('t', 0);
     		$max_post_time = 0;
     		$topic_tracking_info = array();
		 	$topic_tracking_info = get_complete_topic_tracking($forum_id, $row['topic_id']);
			
			if ($row['post_time'] > $max_post_time)
			{
			$max_post_time = $row['post_time'];
			}
			if (isset($topic_tracking_info[$row['topic_id']]) && $row['topic_last_post_time'] > $topic_tracking_info[$row['topic_id']] && $max_post_time > $topic_tracking_info[$row['topic_id']])
			{
 
			markread('topic', $forum_id, $topic_id, $max_post_time);
			}
I should mention that the link I click does not link to the viewtopic.php file. Instead it links to another php file I created. That file gets the post and displays it in my webpage. Clicking on the link will mark the topic as read, but the forum it's in will remain unread, even if there are no unread posts in it. This won't change until I go into the forum manually via the forum. Seems like that refreshes it's status and it returns to being read.

The code above depicts only the portion of my file that marks the topic unread. Can anyone help me with why the forum isn't automatically updated to read after this?

Thanks for any help :)
EAnushan
Registered User
Posts: 17
Joined: Fri Aug 15, 2008 1:53 pm

Re: Update forum unread status

Post by EAnushan »

Seems I forgot this line after the bit of code above:

Code: Select all

update_forum_tracking_info($row['forum_id'], $row['forum_last_post_time'], false, $topic_tracking_info[$row['topic_id']]);
Locked

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