diff --git a/Sources/Post.php b/Sources/Post.php index 90b21d3cc6..750f90c957 100644 --- a/Sources/Post.php +++ b/Sources/Post.php @@ -748,9 +748,11 @@ function Post($post_errors = array()) // When was it last modified? if (!empty($row['modified_time'])) { + $modified_reason = $row['modified_reason']; $context['last_modified'] = timeformat($row['modified_time']); $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']) ? '' : ' ' . $txt['last_edit_reason'] . ': ' . $row['modified_reason']; + $context['last_modified_name'] = $row['modified_name']; + $context['last_modified_text'] = sprintf($txt['last_edit_by'], $context['last_modified'], $row['modified_name']) . (empty($row['modified_reason']) ? '' : ' ' . sprintf($txt['last_edit_reason'], $row['modified_reason'])); } // Get the stuff ready for the form. @@ -1612,25 +1614,14 @@ function ($val) use ($smcFunc) 'attributes' => array( 'size' => 80, 'maxlength' => 80, - 'value' => isset($context['last_modified_reason']) ? $context['last_modified_reason'] : '', + // If same user is editing again, keep the previous edit reason by default. + 'value' => isset($modified_reason) && isset($context['last_modified_name']) && $context['last_modified_name'] === $user_info['name'] ? $modified_reason : '', ), + // If message has been edited before, show info about that. + 'after' => empty($context['last_modified_text']) ? '' : '
' . $context['last_modified_text'] . '
', ), ); - // If this message has been edited in the past - display when it was. - if (!empty($context['last_modified_text'])) - { - $context['posting_fields']['modified_time'] = array( - 'label' => array( - 'text' => $txt['modified_time'], - ), - 'input' => array( - 'type' => '', - 'html' => !empty($context['last_modified_text']) ? ltrim(preg_replace('~]*>[^<]*~u', '', $context['last_modified_text']), ': ') : '', - ), - ); - } - // Prior to 2.1.4, the edit reason was not handled as a posting field, // but instead using a hardcoded input in the template file. We've fixed // that in the default theme, but to support any custom themes based on