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']))
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']))
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?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):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. 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']))
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.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']))
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 firstIs there any chance of this messing things up after a future version release?
The total number of edits and "last edited by" are displayed in the post, and each edit is recorded in the Moderator logs.Does it just display the edit information in the Admin logs or does it display it in the message itself?
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.This type of code should have been an option from the start for admins to select weather to use or not on their bbs.