Page 1 of 1

Update forum unread status

Posted: Sat Aug 30, 2008 9:40 pm
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 :)

Re: Update forum unread status

Posted: Sun Aug 31, 2008 4:56 pm
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']]);