Browse Source

+ Allow users to say why they edited a post

Signed-off-by: Michael Eshom <[email protected]>
Michael Eshom 11 years ago
parent
commit
db058fdaf1

+ 6 - 1
Sources/Display.php

@@ -1305,7 +1305,8 @@ function prepareDisplayContext($reset = false)
 		'modified' => array(
 		'modified' => array(
 			'time' => timeformat($message['modified_time']),
 			'time' => timeformat($message['modified_time']),
 			'timestamp' => forum_time(true, $message['modified_time']),
 			'timestamp' => forum_time(true, $message['modified_time']),
-			'name' => $message['modified_name']
+			'name' => $message['modified_name'],
+			'reason' => $message['modified_reason']
 		),
 		),
 		'likes' => array(
 		'likes' => array(
 			'count' => $message['likes'],
 			'count' => $message['likes'],
@@ -1328,6 +1329,10 @@ function prepareDisplayContext($reset = false)
 	$output['is_message_author'] = $message['id_member'] == $user_info['id'];
 	$output['is_message_author'] = $message['id_member'] == $user_info['id'];
 	if (!empty($output['modified']['name']))
 	if (!empty($output['modified']['name']))
 		$output['modified']['last_edit_text'] = sprintf($txt['last_edit_by'], $output['modified']['time'], $output['modified']['name']);
 		$output['modified']['last_edit_text'] = sprintf($txt['last_edit_by'], $output['modified']['time'], $output['modified']['name']);
+	
+	// Did they give a reason for editing?
+	if (!empty($output['modified']['name']) && !empty($output['modified']['reason']))
+		$output['modified']['last_edit_text'] .= '&nbsp;' . sprintf($txt['last_edit_reason'], $output['modified']['reason']);
 
 
 	call_integration_hook('integrate_prepare_display_context', array(&$output, &$message));
 	call_integration_hook('integrate_prepare_display_context', array(&$output, &$message));
 
 

+ 25 - 5
Sources/Post.php

@@ -83,7 +83,7 @@ function Post($post_errors = array())
 		$request = $smcFunc['db_query']('', '
 		$request = $smcFunc['db_query']('', '
 			SELECT
 			SELECT
 				t.locked, IFNULL(ln.id_topic, 0) AS notify, t.is_sticky, t.id_poll, t.id_last_msg, mf.id_member,
 				t.locked, IFNULL(ln.id_topic, 0) AS notify, t.is_sticky, t.id_poll, t.id_last_msg, mf.id_member,
-				t.id_first_msg, mf.subject,
+				t.id_first_msg, mf.subject, ml.modified_reason,
 				CASE WHEN ml.poster_time > ml.modified_time THEN ml.poster_time ELSE ml.modified_time END AS last_post_time
 				CASE WHEN ml.poster_time > ml.modified_time THEN ml.poster_time ELSE ml.modified_time END AS last_post_time
 			FROM {db_prefix}topics AS t
 			FROM {db_prefix}topics AS t
 				LEFT JOIN {db_prefix}log_notify AS ln ON (ln.id_topic = t.id_topic AND ln.id_member = {int:current_member})
 				LEFT JOIN {db_prefix}log_notify AS ln ON (ln.id_topic = t.id_topic AND ln.id_member = {int:current_member})
@@ -96,7 +96,7 @@ function Post($post_errors = array())
 				'current_topic' => $topic,
 				'current_topic' => $topic,
 			)
 			)
 		);
 		);
-		list ($locked, $context['notify'], $sticky, $pollID, $context['topic_last_message'], $id_member_poster, $id_first_msg, $first_subject, $lastPostTime) = $smcFunc['db_fetch_row']($request);
+		list ($locked, $context['notify'], $sticky, $pollID, $context['topic_last_message'], $id_member_poster, $id_first_msg, $first_subject, $editReason, $lastPostTime) = $smcFunc['db_fetch_row']($request);
 		$smcFunc['db_free_result']($request);
 		$smcFunc['db_free_result']($request);
 
 
 		// If this topic already has a poll, they sure can't add another.
 		// If this topic already has a poll, they sure can't add another.
@@ -605,12 +605,14 @@ function Post($post_errors = array())
 	// Editing a message...
 	// Editing a message...
 	elseif (isset($_REQUEST['msg']) && !empty($topic))
 	elseif (isset($_REQUEST['msg']) && !empty($topic))
 	{
 	{
+		$context['editing'] = true;
+
 		$_REQUEST['msg'] = (int) $_REQUEST['msg'];
 		$_REQUEST['msg'] = (int) $_REQUEST['msg'];
 
 
 		// Get the existing message. Editing.
 		// Get the existing message. Editing.
 		$request = $smcFunc['db_query']('', '
 		$request = $smcFunc['db_query']('', '
 			SELECT
 			SELECT
-				m.id_member, m.modified_time, m.modified_name, m.smileys_enabled, m.body,
+				m.id_member, m.modified_time, m.modified_name, m.modified_reason, m.smileys_enabled, m.body,
 				m.poster_name, m.poster_email, m.subject, m.icon, m.approved,
 				m.poster_name, m.poster_email, m.subject, m.icon, m.approved,
 				IFNULL(a.size, -1) AS filesize, a.filename, a.id_attach,
 				IFNULL(a.size, -1) AS filesize, a.filename, a.id_attach,
 				a.approved AS attachment_approved, t.id_member_started AS id_member_poster,
 				a.approved AS attachment_approved, t.id_member_started AS id_member_poster,
@@ -663,7 +665,8 @@ function Post($post_errors = array())
 		if (!empty($row['modified_time']))
 		if (!empty($row['modified_time']))
 		{
 		{
 			$context['last_modified'] = timeformat($row['modified_time']);
 			$context['last_modified'] = timeformat($row['modified_time']);
-			$context['last_modified_text'] = sprintf($txt['last_edit_by'], $context['last_modified'], $row['modified_name']);
+			$context['last_modified_reason'] = censorText($row['modified_reason']);
+			$context['last_modified_text'] = sprintf($txt['last_edit_by'], $context['last_modified'], $row['modified_name']) . empty($row['modified_reason']) ? '' : '&nbsp;' . $txt['last_edit_reason'] . ':&nbsp;' . $row['modified_reason'];
 		}
 		}
 
 
 		// Get the stuff ready for the form.
 		// Get the stuff ready for the form.
@@ -1615,11 +1618,16 @@ function Post2()
 	$_POST['subject'] = strtr($smcFunc['htmlspecialchars']($_POST['subject']), array("\r" => '', "\n" => '', "\t" => ''));
 	$_POST['subject'] = strtr($smcFunc['htmlspecialchars']($_POST['subject']), array("\r" => '', "\n" => '', "\t" => ''));
 	$_POST['guestname'] = $smcFunc['htmlspecialchars']($_POST['guestname']);
 	$_POST['guestname'] = $smcFunc['htmlspecialchars']($_POST['guestname']);
 	$_POST['email'] = $smcFunc['htmlspecialchars']($_POST['email']);
 	$_POST['email'] = $smcFunc['htmlspecialchars']($_POST['email']);
+	$_POST['modify_reason'] = empty($_POST['modify_reason']) ? '' : strtr($smcFunc['htmlspecialchars']($_POST['modify_reason']), array("\r" => '', "\n" => '', "\t" => ''));
 
 
 	// At this point, we want to make sure the subject isn't too long.
 	// At this point, we want to make sure the subject isn't too long.
 	if ($smcFunc['strlen']($_POST['subject']) > 100)
 	if ($smcFunc['strlen']($_POST['subject']) > 100)
 		$_POST['subject'] = $smcFunc['substr']($_POST['subject'], 0, 100);
 		$_POST['subject'] = $smcFunc['substr']($_POST['subject'], 0, 100);
 
 
+	// Same with the "why did you edit this" text.
+	if ($smcFunc['strlen']($_POST['modify_reason']) > 100)
+		$_POST['modify_reason'] = $smcFunc['substr']($_POST['modify_reason'], 0, 100);
+
 	// Make the poll...
 	// Make the poll...
 	if (isset($_REQUEST['poll']))
 	if (isset($_REQUEST['poll']))
 	{
 	{
@@ -1813,6 +1821,7 @@ function Post2()
 		{
 		{
 			$msgOptions['modify_time'] = time();
 			$msgOptions['modify_time'] = time();
 			$msgOptions['modify_name'] = $user_info['name'];
 			$msgOptions['modify_name'] = $user_info['name'];
+			$msgOptions['modify_reason'] = $_POST['modify_reason']; 
 		}
 		}
 
 
 		// This will save some time...
 		// This will save some time...
@@ -2638,7 +2647,7 @@ function JavaScriptModify()
 		SELECT
 		SELECT
 			t.locked, t.num_replies, t.id_member_started, t.id_first_msg,
 			t.locked, t.num_replies, t.id_member_started, t.id_first_msg,
 			m.id_msg, m.id_member, m.poster_time, m.subject, m.smileys_enabled, m.body, m.icon,
 			m.id_msg, m.id_member, m.poster_time, m.subject, m.smileys_enabled, m.body, m.icon,
-			m.modified_time, m.modified_name, m.approved
+			m.modified_time, m.modified_name, m.modified_reason, m.approved
 		FROM {db_prefix}messages AS m
 		FROM {db_prefix}messages AS m
 			INNER JOIN {db_prefix}topics AS t ON (t.id_topic = {int:current_topic})
 			INNER JOIN {db_prefix}topics AS t ON (t.id_topic = {int:current_topic})
 		WHERE m.id_msg = {raw:id_msg}
 		WHERE m.id_msg = {raw:id_msg}
@@ -2744,6 +2753,15 @@ function JavaScriptModify()
 	if (isset($_POST['sticky']) && !allowedTo('make_sticky'))
 	if (isset($_POST['sticky']) && !allowedTo('make_sticky'))
 		unset($_POST['sticky']);
 		unset($_POST['sticky']);
 
 
+	if (isset($_POST['modify_reason']))
+	{
+		$_POST['modify_reason'] = strtr($smcFunc['htmlspecialchars']($_POST['modify_reason']), array("\r" => '', "\n" => '', "\t" => ''));
+
+		// Maximum number of characters.
+		if ($smcFunc['strlen']($_POST['modify_reason']) > 100)
+			$_POST['modify_reason'] = $smcFunc['substr']($_POST['modify_reason'], 0, 100);
+	}
+
 	if (empty($post_errors))
 	if (empty($post_errors))
 	{
 	{
 		$msgOptions = array(
 		$msgOptions = array(
@@ -2769,6 +2787,7 @@ function JavaScriptModify()
 			{
 			{
 				$msgOptions['modify_time'] = time();
 				$msgOptions['modify_time'] = time();
 				$msgOptions['modify_name'] = $user_info['name'];
 				$msgOptions['modify_name'] = $user_info['name'];
+				$msgOptions['modify_reason'] = isset($_POST['modify_reason']) ? $_POST['modify_reason'] : '';
 			}
 			}
 		}
 		}
 		// If nothing was changed there's no need to add an entry to the moderation log.
 		// If nothing was changed there's no need to add an entry to the moderation log.
@@ -2782,6 +2801,7 @@ function JavaScriptModify()
 		{
 		{
 			$msgOptions['modify_time'] = $row['modified_time'];
 			$msgOptions['modify_time'] = $row['modified_time'];
 			$msgOptions['modify_name'] = $row['modified_name'];
 			$msgOptions['modify_name'] = $row['modified_name'];
+			$msgOptions['modify_reason'] = $row['modified_reason'];
 		}
 		}
 
 
 		// Changing the first subject updates other subjects to 'Re: new_subject'.
 		// Changing the first subject updates other subjects to 'Re: new_subject'.

+ 1 - 0
Sources/Subs-Post.php

@@ -2141,6 +2141,7 @@ function modifyPost(&$msgOptions, &$topicOptions, &$posterOptions)
 	{
 	{
 		$messages_columns['modified_time'] = $msgOptions['modify_time'];
 		$messages_columns['modified_time'] = $msgOptions['modify_time'];
 		$messages_columns['modified_name'] = $msgOptions['modify_name'];
 		$messages_columns['modified_name'] = $msgOptions['modify_name'];
+		$messages_columns['modified_reason'] = $msgOptions['modify_reason'];
 		$messages_columns['id_msg_modified'] = $modSettings['maxMsgID'];
 		$messages_columns['id_msg_modified'] = $modSettings['maxMsgID'];
 	}
 	}
 	if (isset($msgOptions['smileys_enabled']))
 	if (isset($msgOptions['smileys_enabled']))

+ 2 - 0
Themes/default/Display.template.php

@@ -926,6 +926,8 @@ function template_main()
 							sTemplateBodyNormal: ', JavaScriptEscape('%body%'), ',
 							sTemplateBodyNormal: ', JavaScriptEscape('%body%'), ',
 							sTemplateSubjectNormal: ', JavaScriptEscape('<a href="' . $scripturl . '?topic=' . $context['current_topic'] . '.msg%msg_id%#msg%msg_id%" rel="nofollow">%subject%</a>'), ',
 							sTemplateSubjectNormal: ', JavaScriptEscape('<a href="' . $scripturl . '?topic=' . $context['current_topic'] . '.msg%msg_id%#msg%msg_id%" rel="nofollow">%subject%</a>'), ',
 							sTemplateTopSubject: ', JavaScriptEscape($txt['topic'] . ': %subject% &nbsp;(' . $context['num_views_text'] . ')'), ',
 							sTemplateTopSubject: ', JavaScriptEscape($txt['topic'] . ': %subject% &nbsp;(' . $context['num_views_text'] . ')'), ',
+							sTemplateReasonEdit: ', JavaScriptEscape('<input type="text" style="width: 90%;" name="modify_reason" value="%modify_reason%" size="80" maxlength="80" tabindex="' . $context['tabindex']++ . '" class="input_text" />)
+							sTemplateReasonNormal: ', JavaScriptEscape('%modify_text'), '
 							sErrorBorderStyle: ', JavaScriptEscape('1px solid red'), ($context['can_reply'] && !empty($options['display_quick_reply'])) ? ',
 							sErrorBorderStyle: ', JavaScriptEscape('1px solid red'), ($context['can_reply'] && !empty($options['display_quick_reply'])) ? ',
 							sFormRemoveAccessKeys: \'postmodify\'' : '', '
 							sFormRemoveAccessKeys: \'postmodify\'' : '', '
 						});
 						});

+ 12 - 0
Themes/default/Post.template.php

@@ -357,6 +357,18 @@ function template_main()
 	echo '
 	echo '
 					', template_control_richedit($context['post_box_name'], 'smileyBox_message', 'bbcBox_message');
 					', template_control_richedit($context['post_box_name'], 'smileyBox_message', 'bbcBox_message');
 
 
+	// If we're editing and displaying edit details, show a box where they can say why
+	if (isset($context['editing']) && $settings['show_last_edit'])
+		echo '
+					<dl>
+						<dt class="clear">
+							<span id="caption_edit_reason">', $txt['reason_for_edit'], ':</span>
+						</dt>
+						<dd>
+							<input type="text" name="modify_reason"', $context['last_modified_reason'] == '' ? '' : ' value="' . $context['modified_reason'] . '"', ' tabindex="', $context['tabindex']++, '" size="80" maxlength="80" class="input_text" />
+						</dd>
+					</dl>';
+
 	// If this message has been edited in the past - display when it was.
 	// If this message has been edited in the past - display when it was.
 	if (isset($context['last_modified']))
 	if (isset($context['last_modified']))
 		echo '
 		echo '

+ 10 - 2
Themes/default/Xml.template.php

@@ -51,8 +51,12 @@ function template_modifydone()
 	<message id="msg_', $context['message']['id'], '">';
 	<message id="msg_', $context['message']['id'], '">';
 	if (empty($context['message']['errors']))
 	if (empty($context['message']['errors']))
 	{
 	{
+		// Build our string of info about when and why it was modified
+		$modified = empty($context['message']['modified']['time']) ? '' : sprintf($txt['last_edit_by'], $context['message']['modified']['time'], $context['message']['modified']['name']);
+		$modified .= empty($context['message']['modified']['reason']) ? '' : sprintf($txt['last_edit_reason'], $context['message']['modified']['reason']);
+
 		echo '
 		echo '
-		<modified><![CDATA[', empty($context['message']['modified']['time']) ? '' : cleanXml('&#171; <em>' . sprintf($txt['last_edit_by'], $context['message']['modified']['time'], $context['message']['modified']['name']) . '</em> &#187;'), ']]></modified>
+		<modified><![CDATA[', empty($modified) ? '' : cleanXml('&#171; <em>' . $modified . '</em>&#187;'), ']]></modified>
 		<subject is_first="', $context['message']['first_in_topic'] ? '1' : '0', '"><![CDATA[', cleanXml($context['message']['subject']), ']]></subject>
 		<subject is_first="', $context['message']['first_in_topic'] ? '1' : '0', '"><![CDATA[', cleanXml($context['message']['subject']), ']]></subject>
 		<body><![CDATA[', $context['message']['body'], ']]></body>';
 		<body><![CDATA[', $context['message']['body'], ']]></body>';
 	}
 	}
@@ -73,8 +77,12 @@ function template_modifytopicdone()
 	<message id="msg_', $context['message']['id'], '">';
 	<message id="msg_', $context['message']['id'], '">';
 	if (empty($context['message']['errors']))
 	if (empty($context['message']['errors']))
 	{
 	{
+		// Build our string of info about when and why it was modified
+		$modified = empty($context['message']['modified']['time']) ? '' : sprintf($txt['last_edit_by'], $context['message']['modified']['time'], $context['message']['modified']['name']);
+		$modified .= empty($context['message']['modified']['reason']) ? '' : sprintf($txt['last_edit_reason'], $context['message']['modified']['reason']);
+
 		echo '
 		echo '
-		<modified><![CDATA[', empty($context['message']['modified']['time']) ? '' : cleanXml('&#171; <em>' . sprintf($txt['last_edit_by'], $context['message']['modified']['time'], $context['message']['modified']['name']) . '</em> &#187;'), ']]></modified>';
+		<modified><![CDATA[', empty($modified) ? '' : cleanXml('&#171; <em>' . $modified . '</em>&#187;'), ']]></modified>';
 		if (!empty($context['message']['subject']))
 		if (!empty($context['message']['subject']))
 			echo '
 			echo '
 		<subject><![CDATA[', cleanXml($context['message']['subject']), ']]></subject>';
 		<subject><![CDATA[', cleanXml($context['message']['subject']), ']]></subject>';

+ 2 - 0
Themes/default/languages/index.english.php

@@ -76,6 +76,7 @@ $txt['subject'] = 'Subject';
 $txt['message'] = 'Message';
 $txt['message'] = 'Message';
 $txt['redirects'] = 'Redirects';
 $txt['redirects'] = 'Redirects';
 $txt['quick_modify'] = 'Modify Inline';
 $txt['quick_modify'] = 'Modify Inline';
+$txt['reason_for_edit'] = 'Reason for editing';
 
 
 $txt['choose_pass'] = 'Choose password';
 $txt['choose_pass'] = 'Choose password';
 $txt['verify_pass'] = 'Verify password';
 $txt['verify_pass'] = 'Verify password';
@@ -188,6 +189,7 @@ $txt['memberlist_searchable'] = 'Searchable list of all registered members.';
 $txt['welcome_newest_member'] = 'Please welcome %1$s, our newest member.';
 $txt['welcome_newest_member'] = 'Please welcome %1$s, our newest member.';
 $txt['admin_center'] = 'Administration Center';
 $txt['admin_center'] = 'Administration Center';
 $txt['last_edit_by'] = '<span class="lastedit">Last Edit</span>: %1$s by %2$s';
 $txt['last_edit_by'] = '<span class="lastedit">Last Edit</span>: %1$s by %2$s';
+$txt['last_edit_reason'] = '<span class="lastedit">Reason</span>: %1$s';
 $txt['notify_deactivate'] = 'Would you like to deactivate notification on this topic?';
 $txt['notify_deactivate'] = 'Would you like to deactivate notification on this topic?';
 
 
 $txt['recent_posts'] = 'Recent Posts';
 $txt['recent_posts'] = 'Recent Posts';

+ 1 - 0
other/install_2-1_mysql.sql

@@ -1365,6 +1365,7 @@ CREATE TABLE {$db_prefix}messages (
   smileys_enabled tinyint(4) NOT NULL default '1',
   smileys_enabled tinyint(4) NOT NULL default '1',
   modified_time int(10) unsigned NOT NULL default '0',
   modified_time int(10) unsigned NOT NULL default '0',
   modified_name varchar(255) NOT NULL default '',
   modified_name varchar(255) NOT NULL default '',
+  modified_reason varchar(255) NOT NULL default '',
   body text NOT NULL,
   body text NOT NULL,
   icon varchar(16) NOT NULL default 'xx',
   icon varchar(16) NOT NULL default 'xx',
   approved tinyint(3) NOT NULL default '1',
   approved tinyint(3) NOT NULL default '1',

+ 1 - 0
other/install_2-1_postgresql.sql

@@ -1794,6 +1794,7 @@ CREATE TABLE {$db_prefix}messages (
   smileys_enabled smallint NOT NULL default '1',
   smileys_enabled smallint NOT NULL default '1',
   modified_time int NOT NULL default '0',
   modified_time int NOT NULL default '0',
   modified_name varchar(255) NOT NULL,
   modified_name varchar(255) NOT NULL,
+  modified_reason varchar(255) NOT NULL,
   body text NOT NULL,
   body text NOT NULL,
   icon varchar(16) NOT NULL default 'xx',
   icon varchar(16) NOT NULL default 'xx',
   approved smallint NOT NULL default '1',
   approved smallint NOT NULL default '1',

+ 1 - 0
other/install_2-1_sqlite.sql

@@ -1482,6 +1482,7 @@ CREATE TABLE {$db_prefix}messages (
   smileys_enabled smallint NOT NULL default '1',
   smileys_enabled smallint NOT NULL default '1',
   modified_time int NOT NULL default '0',
   modified_time int NOT NULL default '0',
   modified_name varchar(255) NOT NULL,
   modified_name varchar(255) NOT NULL,
+  modified_reason varchar(255) NOT NULL,
   body text NOT NULL,
   body text NOT NULL,
   icon varchar(16) NOT NULL default 'xx',
   icon varchar(16) NOT NULL default 'xx',
   approved smallint NOT NULL default '1',
   approved smallint NOT NULL default '1',

+ 1 - 0
other/install_2-1_sqlite3.sql

@@ -1482,6 +1482,7 @@ CREATE TABLE {$db_prefix}messages (
   smileys_enabled smallint NOT NULL default '1',
   smileys_enabled smallint NOT NULL default '1',
   modified_time int NOT NULL default '0',
   modified_time int NOT NULL default '0',
   modified_name varchar(255) NOT NULL,
   modified_name varchar(255) NOT NULL,
+  modified_reason varchar(255) NOT NULL,
   body text NOT NULL,
   body text NOT NULL,
   icon varchar(16) NOT NULL default 'xx',
   icon varchar(16) NOT NULL default 'xx',
   approved smallint NOT NULL default '1',
   approved smallint NOT NULL default '1',

+ 8 - 0
other/upgrade_2-1_mysql.sql

@@ -739,4 +739,12 @@ ADD COLUMN in_inbox tinyint(3) NOT NULL default '1';
 		$smcFunc['db_remove_column']('{db_prefix}pm_recipients', 'labels');
 		$smcFunc['db_remove_column']('{db_prefix}pm_recipients', 'labels');
 	}
 	}
 ---}
 ---}
+---#
+
+/******************************************************************************/
+--- Adding support for edit reasons
+/******************************************************************************/
+---# Adding "modified_reason" column to messages
+ALTER TABLE {$db_prefix}messages
+ADD COLUMN modified_reason varchar(255) NOT NULL;
 ---#
 ---#

+ 9 - 1
other/upgrade_2-1_postgresql.sql

@@ -821,4 +821,12 @@ ADD COLUMN in_inbox smallint NOT NULL default '1';
 		$smcFunc['db_remove_column']('{db_prefix}members', 'message_labels');
 		$smcFunc['db_remove_column']('{db_prefix}members', 'message_labels');
 		$smcFunc['db_remove_column']('{db_prefix}pm_recipients', 'labels');
 		$smcFunc['db_remove_column']('{db_prefix}pm_recipients', 'labels');
 	}
 	}
-}
+}
+
+/******************************************************************************/
+--- Adding support for edit reasons
+/******************************************************************************/
+---# Adding "modified_reason" column to messages
+ALTER TABLE {$db_prefix}messages
+ADD COLUMN modified_reason varchar(255) NOT NULL default '';
+---#

+ 9 - 1
other/upgrade_2-1_sqlite.sql

@@ -798,4 +798,12 @@ ADD COLUMN in_inbox tinyint(3) NOT NULL default '1';
 		$smcFunc['db_remove_column']('{db_prefix}members', 'message_labels');
 		$smcFunc['db_remove_column']('{db_prefix}members', 'message_labels');
 		$smcFunc['db_remove_column']('{db_prefix}pm_recipients', 'labels');
 		$smcFunc['db_remove_column']('{db_prefix}pm_recipients', 'labels');
 	}
 	}
-}
+}
+
+/******************************************************************************/
+--- Adding support for edit reasons
+/******************************************************************************/
+---# Adding "modified_reason" column to messages
+ALTER TABLE {$db_prefix}messages
+ADD COLUMN modified_reason varchar(255) NOT NULL default '';
+---#