Display last edited time information:

Get help with installation and running phpBB 3.0.x here. Please do not post bug reports, feature requests, or MOD-related questions here.
Anti-Spam Guide
Forum rules
END OF SUPPORT: 1 January 2017 (announcement)
pumpkinkid
Registered User
Posts: 91
Joined: Wed Oct 31, 2007 3:36 am

Re: Display last edited time information:

Post 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...
wildbill
Registered User
Posts: 54
Joined: Wed Aug 08, 2007 5:17 pm
Location: Central Ohio, USA

Re: Display last edited time information:

Post 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.
pumpkinkid
Registered User
Posts: 91
Joined: Wed Oct 31, 2007 3:36 am

Re: Display last edited time information:

Post 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
Kubbie
Registered User
Posts: 42
Joined: Wed Jun 13, 2007 1:50 pm

Re: Display last edited time information:

Post 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.
wildbill
Registered User
Posts: 54
Joined: Wed Aug 08, 2007 5:17 pm
Location: Central Ohio, USA

Re: Display last edited time information:

Post 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.
Kubbie
Registered User
Posts: 42
Joined: Wed Jun 13, 2007 1:50 pm

Re: Display last edited time information:

Post 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. :)
User avatar
philwhite
Registered User
Posts: 122
Joined: Wed Aug 22, 2007 12:47 am
Contact:

Re: Display last edited time information:

Post by philwhite »

See my comment here for another take. It worked for me.
It's only words...
Wordwizard.com
denu
Registered User
Posts: 28
Joined: Sun Aug 31, 2008 10:27 am

Re: Display last edited time information:

Post by denu »

thanks, that's very useful modification!

greetz
sorry for meeztakez
clight77
Registered User
Posts: 907
Joined: Sun May 11, 2003 11:09 pm

Re: Display last edited time information:

Post by clight77 »

Thanks,good thing..
I Follow Up On My Posts.
So Should Everybody...
svenx
Registered User
Posts: 1
Joined: Tue Aug 18, 2009 12:24 pm

Re: Display last edited time information:

Post by svenx »

Hello,

Just applied this to my board, is it possible to filter admins and mods from displaying `Last edited information`?
dmbgreystreet09
Registered User
Posts: 3
Joined: Sat Sep 12, 2009 6:45 pm

Re: Display last edited time information:

Post 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
Kuuupo
Registered User
Posts: 14
Joined: Sat Feb 13, 2010 1:28 am

Re: Display last edited time information:

Post 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.
The Jak-L
Registered User
Posts: 19
Joined: Sun Apr 23, 2006 5:21 pm

Re: Display last edited time information:

Post 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.
MADD1
Registered User
Posts: 3
Joined: Fri Jan 04, 2013 7:41 pm

Re: Display last edited time information:

Post 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.
Locked

Return to “[3.0.x] Support Forum”