MyBB Community Forums

Full Version: Mark thread as unread on post editing
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Currently, after you read a thread and one edits one's post, there is no way for you to see that something has changed other than specifically visit the thread from time to time.

I suggest that upon post edit the post to be marked as new so that the thread becomes unread. This could also help reducing bumping only for posts.
Agreed with the suggestion.

I thought about that and edited the forumdisplay.php (in v.1.6), line no. 1133

Changing this line:
if($thread['lastpost'] > $last_read && $moved[0] != "moved")

to

$query = $db->simple_select("posts", "edittime", "dateline='{$thread['lastpost']}' AND tid='{$thread['tid']}'");
		while($lastedit = $db->fetch_array($query))
		{
			$last_action = $lastedit['edittime'] > $thread['lastpost'] ? $lastedit['edittime'] : $thread['lastpost'];
		}

		if($last_action > $last_read && $moved[0] != "moved")

But too lazy to test the modification. Don't know if anywhere more it is required to be changes :p
But what if it was a large thread, for example /me thread, and it was a post in the middle. How would you know what's changed?
Hmm ... need to query all the posts in the thread and get the highest lastedit timestamp then?
I guess we could update lastpost on post edit.
Not very cool feature, might take up loading time.
(2014-01-27, 09:13 AM)Cedric Wrote: [ -> ]Not very cool feature, might take up loading time.

Only if you write an extra query that checks all of the posts, which is a little ridiculous for what is needed.

The following is a much cleaner faster way:
(2014-01-26, 11:43 AM)Kaeden Wrote: [ -> ]I guess we could update lastpost on post edit.
That would be more efficient but last post sounds like it is referring to the last post in a thread not the last post to be edited.
Personally I think should be in a plugin, if someone is willing to create one.
(2014-01-27, 08:19 PM)JordanMussi Wrote: [ -> ]That would be more efficient but last post sounds like it is referring to the last post in a thread not the last post to be edited.
Personally I think should be in a plugin, if someone is willing to create one.

You know, I think I have changed my mind and agree with you.
Read statuses should be deleted from the DB after editing a post in a thread. Similar to what I do in my Bump Thread plugin:
	// Bump a thread
	function bump($args)
	{
		global $db, $plugins;

		$db->update_query('threads', array('lastpostbump' => TIME_NOW), 'tid='.(int)$args['tid']);
		$db->delete_query('forumsread', 'fid=\''.(int)$args['fid'].'\'');
		$db->delete_query('threadsread', 'tid=\''.(int)$args['tid'].'\'');

		$plugins->run_hooks('npbumpthread_bump_thread', $args);
	}