Page 2 of 2

Re: Display last edited time information:

Posted: Fri Nov 23, 2007 4:14 pm
by pumpkinkid
I thought about that, It shouldn't matter, truth of the matter is that its an "or" so in theory it should not affect it. then again, in theory it seem that the or is unnecessary considering that if you have an "edited reason" it should also have a "edited message"

again, in theory that should mean that the fact that the message was edited should allow it to display...

I actually tried something like this, cant remember what it was, but it ended up displaying the horizontal lines of the edited message on all my posts, edited or not...

Re: Display last edited time information:

Posted: Fri Nov 23, 2007 5:35 pm
by wildbill
The default behavior of edits, even with the setting on in the ACP, is not to display an edit time if the edit is to the most recent post or if it was an admin/mod edit without an edit reason being given. I wasn't happy with not knowing (or showing) all edits, so I made the following changes to includes/functions_posting.php to log and display all edits - regardless of whether replies had been made or if it was an admin/mod editing the post:

functions_posting.php Find (~ Line 1621):

Code: Select all

		case 'edit_topic':

			// If edit reason is given always display edit info

			// If editing last post then display no edit info
			// If m_edit permission then display no edit info
			// If normal edit display edit info

			// Display edit info if edit reason given or user is editing his post, which is not the last within the topic.
			if ($data['post_edit_reason'] || (!$auth->acl_get('m_edit', $data['forum_id']) && ($post_mode == 'edit' || $post_mode == 'edit_first_post')))
			{
				$sql_data[POSTS_TABLE]['sql'] = array(
					'post_edit_time'	=> $current_time,
					'post_edit_reason'	=> $data['post_edit_reason'],
					'post_edit_user'	=> (int) $data['post_edit_user'],
				);

				$sql_data[POSTS_TABLE]['stat'][] = 'post_edit_count = post_edit_count + 1';
			}
			else if (!$data['post_edit_reason'] && $mode == 'edit' && $auth->acl_get('m_edit', $data['forum_id']))
			{
				$sql_data[POSTS_TABLE]['sql'] = array(
					'post_edit_reason'	=> '',
				);
			}

			// If the person editing this post is different to the one having posted then we will add a log entry stating the edit
			// Could be simplified by only adding to the log if the edit is not tracked - but this may confuse admins/mods
			if ($user->data['user_id'] != $poster_id)
			{
				$log_subject = ($subject) ? $subject : $data['topic_title'];
				add_log('mod', $data['forum_id'], $data['topic_id'], 'LOG_POST_EDITED', $log_subject, (!empty($username)) ? $username : $user->lang['GUEST']);
			}

			if (!isset($sql_data[POSTS_TABLE]['sql']))
Replace with:

Code: Select all

		case 'edit_topic':

			// If edit reason is given always display edit info

			// If editing last post then display no edit info
			// If m_edit permission then display no edit info
			// If normal edit display edit info

			// Display edit info if edit reason given or user is editing his post, which is not the last within the topic.
				$sql_data[POSTS_TABLE]['sql'] = array(
					'post_edit_time'	=> $current_time,
					'post_edit_reason'	=> $data['post_edit_reason'],
					'post_edit_user'	=> (int) $data['post_edit_user'],
				);

				$sql_data[POSTS_TABLE]['stat'][] = 'post_edit_count = post_edit_count + 1';

			// If the person editing this post is different to the one having posted then we will add a log entry stating the edit
			// Could be simplified by only adding to the log if the edit is not tracked - but this may confuse admins/mods
					$log_subject = ($subject) ? $subject : $data['topic_title'];
				add_log('mod', $data['forum_id'], $data['topic_id'], 'LOG_POST_EDITED', $log_subject, (!empty($username)) ? $username : $user->lang['GUEST']);
			
			if (!isset($sql_data[POSTS_TABLE]['sql']))
Each time I upgrade, the code has to be reapplied and tested, but in my case, knowing who is editing each post is well worth the additional efforts.

Re: Display last edited time information:

Posted: Fri Nov 23, 2007 6:11 pm
by pumpkinkid
awesome! thank you very much!

The only thing I don't like is that it displays only after that patch was applied... is there any way to make it retro-active? Not that it matters, I wont ever take it off again :P

BTW, how is it that a new user's first post is more helpful than everyone else here?

I really appreciate the help :D

Re: Display last edited time information:

Posted: Tue Dec 11, 2007 7:53 pm
by Kubbie
wildbill wrote:The default behavior of edits, even with the setting on in the ACP, is not to display an edit time if the edit is to the most recent post or if it was an admin/mod edit without an edit reason being given. I wasn't happy with not knowing (or showing) all edits, so I made the following changes to includes/functions_posting.php to log and display all edits - regardless of whether replies had been made or if it was an admin/mod editing the post:

functions_posting.php Find (~ Line 1621):

Code: Select all

		case 'edit_topic':

			// If edit reason is given always display edit info

			// If editing last post then display no edit info
			// If m_edit permission then display no edit info
			// If normal edit display edit info

			// Display edit info if edit reason given or user is editing his post, which is not the last within the topic.
			if ($data['post_edit_reason'] || (!$auth->acl_get('m_edit', $data['forum_id']) && ($post_mode == 'edit' || $post_mode == 'edit_first_post')))
			{
				$sql_data[POSTS_TABLE]['sql'] = array(
					'post_edit_time'	=> $current_time,
					'post_edit_reason'	=> $data['post_edit_reason'],
					'post_edit_user'	=> (int) $data['post_edit_user'],
				);

				$sql_data[POSTS_TABLE]['stat'][] = 'post_edit_count = post_edit_count + 1';
			}
			else if (!$data['post_edit_reason'] && $mode == 'edit' && $auth->acl_get('m_edit', $data['forum_id']))
			{
				$sql_data[POSTS_TABLE]['sql'] = array(
					'post_edit_reason'	=> '',
				);
			}

			// If the person editing this post is different to the one having posted then we will add a log entry stating the edit
			// Could be simplified by only adding to the log if the edit is not tracked - but this may confuse admins/mods
			if ($user->data['user_id'] != $poster_id)
			{
				$log_subject = ($subject) ? $subject : $data['topic_title'];
				add_log('mod', $data['forum_id'], $data['topic_id'], 'LOG_POST_EDITED', $log_subject, (!empty($username)) ? $username : $user->lang['GUEST']);
			}

			if (!isset($sql_data[POSTS_TABLE]['sql']))
Replace with:

Code: Select all

		case 'edit_topic':

			// If edit reason is given always display edit info

			// If editing last post then display no edit info
			// If m_edit permission then display no edit info
			// If normal edit display edit info

			// Display edit info if edit reason given or user is editing his post, which is not the last within the topic.
				$sql_data[POSTS_TABLE]['sql'] = array(
					'post_edit_time'	=> $current_time,
					'post_edit_reason'	=> $data['post_edit_reason'],
					'post_edit_user'	=> (int) $data['post_edit_user'],
				);

				$sql_data[POSTS_TABLE]['stat'][] = 'post_edit_count = post_edit_count + 1';

			// If the person editing this post is different to the one having posted then we will add a log entry stating the edit
			// Could be simplified by only adding to the log if the edit is not tracked - but this may confuse admins/mods
					$log_subject = ($subject) ? $subject : $data['topic_title'];
				add_log('mod', $data['forum_id'], $data['topic_id'], 'LOG_POST_EDITED', $log_subject, (!empty($username)) ? $username : $user->lang['GUEST']);
			
			if (!isset($sql_data[POSTS_TABLE]['sql']))
Each time I upgrade, the code has to be reapplied and tested, but in my case, knowing who is editing each post is well worth the additional efforts.
Thank You for this! I like this idea. I do not know php that well... Is there any chance of this messing things up after a future version release? I haven't tried this out yet and probably will not be able to for the next couple days. Does it just display the edit information in the Admin logs or does it display it in the message itself?

I personally do not mind the actual edited information not being shown (but I do want the edited time/date stamp shownin the message) as long as it is logged in the admin or moderator log to be pulled by moderator or admin if needed.

I was hoping there was a MOD out there for this, but this might do if it logs the information to the log files. Again, thanks wildbill. :D This type of code should have been an option from the start for admins to select weather to use or not on their bbs.

Re: Display last edited time information:

Posted: Tue Dec 11, 2007 11:47 pm
by wildbill
Is there any chance of this messing things up after a future version release?
With each update/upgrade, if functions_posting.php is included in the new files, it will be flagged as a modified file. I always take the new file, check the upgrade, then go back and make the modifications (on a TEST board first ;) ), then do my production board upgrades if everything is working correctly.
Does it just display the edit information in the Admin logs or does it display it in the message itself?
The total number of edits and "last edited by" are displayed in the post, and each edit is recorded in the Moderator logs.
This type of code should have been an option from the start for admins to select weather to use or not on their bbs.
It's not necessarily a change that many people would want - I admin a small, private board, so there aren't many entries to my log files, but I need to know every change that is made (past problems, long story not worth repeating, ancient history now). Anyone with a high volume board might not want the number of log entries this change generates - hundreds or thousands of log entries for typo edits could make it difficult to find a suspicious log entry that would have been caught immediately without all the noise.

Re: Display last edited time information:

Posted: Fri Dec 14, 2007 1:05 pm
by Kubbie
Wildbill, is it possible to add to your code the ability to update the last post date of the topic if someone edits their message (basicly Bump the topic with a date/time update so it shows up as NEW)? For example, I have a user modifying his post in a topic as he adds and subtracts from his inventory. Even though he last edited his message yesterday, it still shows the Last Post date as over two months ago. No one is alerted of the changes unless they actully go in to the topic and check.

Thanks. :)

Re: Display last edited time information:

Posted: Sun Feb 10, 2008 1:39 pm
by philwhite
See my comment here for another take. It worked for me.

Re: Display last edited time information:

Posted: Fri Sep 12, 2008 12:17 am
by denu
thanks, that's very useful modification!

greetz

Re: Display last edited time information:

Posted: Thu Jan 29, 2009 6:04 am
by clight77
Thanks,good thing..

Re: Display last edited time information:

Posted: Tue Aug 18, 2009 12:28 pm
by svenx
Hello,

Just applied this to my board, is it possible to filter admins and mods from displaying `Last edited information`?

Re: Display last edited time information:

Posted: Sun Sep 13, 2009 12:15 am
by dmbgreystreet09
thanks to the programmer who developed this tweak/hack. to up the mod, how would i have it log the LAST EDITED by also show in the TOPICS -> LAST POST part of the forum: http://cornerofgrey-street.com/forum/viewforum.php?f=4

right now it just shows in the forum thread WHICH IS TOTALLY AWESOME but is it possible to show everywhere? and if so how would i do that? thanks :-) and much appreciated

Re: Display last edited time information:

Posted: Sun Feb 14, 2010 12:04 am
by Kuuupo
Thank you Wildbill! Works like a charm.

Dont know if anyones mentioned, but it will only show edits from there on out. Any edits done prior to the edit will remain unseen. Not a problem at all, just noting.

Re: Display last edited time information:

Posted: Mon Nov 15, 2010 2:47 pm
by The Jak-L
Is this still valid for 3.0.7-PL1?

I tried today, quickly mind, but did not get any 'Edited by' entry in the post if the Reason was left Blank.

Or is it theme specific? Though I did just change themes about and no joy (just in case the edits I made still do work.)

Thanks.

Re: Display last edited time information:

Posted: Fri Jan 04, 2013 11:48 pm
by MADD1
has anyone tried this on the latest version of phpbb? it seems like a standard feature to me, strange it isnt included by default.