good mod, but i found a small bug, when a date/time is changed for a post that is the last post someone posted, the time showing for this users last post is not updated. an updated step 6 to fix this minor error is below:
#
#---------[ 6. BEFORE, ADD ]-----------------------------------------------
#
// mod: edit date/time
if ($is_admmod && isset($_POST['silent']))
{
$new_posted = mktime(
intval($_POST['req_posted_hour']),
intval($_POST['req_posted_minute']),
intval($_POST['req_posted_second']),
intval($_POST['req_posted_month']),
intval($_POST['req_posted_day']),
intval($_POST['req_posted_year']));
if ($new_posted == false || $new_posted == -1) // -1 before PHP 5.1
$errors[] = "Invalid post date/time.";
else
{
$new_posted -= $tz_diff;
// Updated with the rest of the post
$new_posted_sql = ', posted='.$new_posted;
// Is this the "topic post"?
if ($id == $topic_post_id)
$db->query('UPDATE '.$db->prefix.'topics SET posted = '.$new_posted.' WHERE id = '.$cur_post['tid']) or error('Unable to update topic', __FILE__, __LINE__, $db->error());
// Try to update topic
$db->query('UPDATE '.$db->prefix.'topics SET last_post = '.$new_posted.' WHERE last_post_id = '.$id) or error('Unable to update topic', __FILE__, __LINE__, $db->error());
update_forum($cur_post['fid']);
// Fetch the post ID of the last post from the user who posted this post that is being edited
// and if this post is the last post he/she posted, then change his/her last post time
$userLastPostIDCheck = $db->query('SELECT id FROM '.$db->prefix.'posts WHERE poster_id = '.$cur_post['poster_id'].' ORDER BY posted DESC LIMIT 1') or error('Unable to fetch post info', __FILE__, __LINE__, $db->error());
if (!$db->num_rows($userLastPostIDCheck)) {
message($lang_common['Bad request']);
}
$userLastPostID = $db->fetch_assoc($userLastPostIDCheck);
if ($userLastPostID['id'] == $id) {
$low_prio = ($db_type == 'mysql') ? 'LOW_PRIORITY ' : '';
$db->query('UPDATE '.$low_prio.$db->prefix.'users SET last_post='.$new_posted.' WHERE id='.$cur_post['poster_id']) or error('Unable to update user', __FILE__, __LINE__, $db->error());
}
}
}
else
$new_posted_sql = '';