diff -ubBr --exclude=uploads --exclude=images --exclude=images_pcf --exclude=config.php --exclude=languages --exclude=settings.php Upload/editpost.php forum/editpost.php
--- Upload/editpost.php	2006-09-03 14:55:50.000000000 +0200
+++ forum/editpost.php	2006-09-06 13:14:05.000000000 +0200
@@ -302,6 +319,9 @@
 		}
 		$plugins->run_hooks("editpost_do_editpost_end");

+		update_thread_data($tid);  // KK: edit_bumps_thread.mod
+		update_forum_lastpost($fid);  // KK: edit_bumps_thread.mod
+
 		redirect($url, $redirect);
 	}
 }
diff -ubBr --exclude=uploads --exclude=images --exclude=images_pcf --exclude=config.php --exclude=languages --exclude=settings.php Upload/inc/functions.php forum/inc/functions.php
--- Upload/inc/functions.php	2006-09-03 15:03:35.000000000 +0200
+++ forum/inc/functions.php	2006-09-10 15:51:07.000000000 +0200
@@ -1472,7 +1287,22 @@
 	);
 	$lastpost = $db->fetch_array($query);
 
+	// KK: edit_bumps_thread.mod
+	$query = $db->query("
+		SELECT u.uid, u.username, p.username AS postusername, p.edittime as dateline
+		FROM ".TABLE_PREFIX."posts p LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid=p.uid)
+		WHERE p.tid='$tid' AND p.visible='1'
+		ORDER BY p.edittime DESC
+		LIMIT 1"
+	);
+	$lastpost_edited = $db->fetch_array($query);
+	if ($lastpost['dateline'] < $lastpost_edited['dateline'])
+	{
+	  $lastpost = &$lastpost_edited ;
+	}
+	// KK^
+
 	$query = $db->query("
 		SELECT u.uid, u.username, p.username AS postusername, p.dateline
 		FROM ".TABLE_PREFIX."posts p
 		LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid=p.uid)
diff -ubBwr --exclude=uploads --exclude=images --exclude=images_pcf --exclude=config.php --exclude=languages/polish --exclude=settings.php Upload/xmlhttp.php forum/xmlhttp.php
--- Upload/xmlhttp.php	2006-09-28 13:02:53.000000000 +0200
+++ forum/xmlhttp.php	2006-10-08 19:59:21.000000000 +0200
@@ -257,6 +273,9 @@
 			);
 			log_moderator_action($modlogdata, "Edited Post");
 		}
+
+		update_thread_data($thread['tid']);  // KK: edit_bumps_thread.mod
+		update_forum_lastpost($forum['fid']);  // KK: edit_bumps_thread.mod
 	}
 
 	// Send our headers.
@@ -376,6 +406,8 @@
 		else
 		{
 			$posthandler->update_post();
+			update_thread_data($post['tid']);  // KK: edit_bumps_thread.mod
+			update_forum_lastpost($post['fid']);  // KK: edit_bumps_thread.mod
 		}
 
 		require_once MYBB_ROOT."inc/class_parser.php";
diff -ubBwr --exclude=uploads --exclude=images --exclude=images_pcf --exclude=config.php --exclude=languages/polish --exclude=settings.php Upload/showthread.php forum/showthread.php
--- Upload/showthread.php	2006-09-28 13:02:53.000000000 +0200
+++ forum/showthread.php	2006-10-15 00:23:37.000000000 +0200
@@ -109,12 +109,14 @@
 	else
 	{
 		$options = array(
-			'order_by' => 'dateline',
+//			'order_by' => 'dateline',	// KK: edit_bumps_thread.mod
+			'order_by' => 'max_dateline',
 			'order_dir' => 'desc',
 			'limit_start' => 0,
 			'limit' => 1
 		);
-		$query = $db->simple_select(TABLE_PREFIX.'posts', 'pid', "tid={$tid}", $options);
+//		$query = $db->simple_select(TABLE_PREFIX.'posts', 'pid', "tid={$tid}", $options); // KK: edit_bumps_thread.mod
+		$query = $db->simple_select(TABLE_PREFIX.'posts', 'pid, GREATEST(dateline, edittime) as max_dateline', "tid={$tid}", $options);
 		$pid = $db->fetch_field($query, "pid");
 	}
 	header("Location:showthread.php?tid={$tid}&pid={$pid}#pid{$pid}");

