Index: trunk/CHANGELOG
===================================================================
--- trunk/CHANGELOG	(revision 446)
+++ trunk/CHANGELOG	(revision 447)
@@ -14,6 +14,8 @@
 24-Jan-2007 Christian Sommer
 !	Replaced some core files to allow configuration of wbmailer via admin settings panel
 ------------------------------------- 2.6.6 -------------------------------------
+30-Apr-2007 Matthias Gallas
+#	Fixed ticket #392; root_parent not being set correctly (Thanks to eggsurplus)
 10-Apr-2007 Matthias Gallas
 +	Optimized search and highlighting funktions (Thanks to thorn)
 03-Apr-2007 Matthias Gallas
Index: trunk/wb/admin/pages/settings2.php
===================================================================
--- trunk/wb/admin/pages/settings2.php	(revision 446)
+++ trunk/wb/admin/pages/settings2.php	(revision 447)
@@ -202,7 +202,7 @@
 }
 
 // Function to fix page trail of subs
-function fix_page_trail($parent) {
+function fix_page_trail($parent,$root_parent) {
 	// Get objects and vars from outside this function
 	global $admin, $template, $database, $TEXT, $MESSAGE;
 	// Get page list from database
@@ -213,14 +213,14 @@
 	if($get_pages->numRows() > 0)	{
 		while($page = $get_pages->fetchRow()) {
 			// Fix page trail
-			$database->query("UPDATE ".TABLE_PREFIX."pages SET page_trail = '".get_page_trail($page['page_id'])."' WHERE page_id = '".$page['page_id']."'");
+			$database->query("UPDATE ".TABLE_PREFIX."pages SET ".($root_parent != 0 ?"root_parent = '$root_parent', ":"")." page_trail = '".get_page_trail($page['page_id'])."' WHERE page_id = '".$page['page_id']."'");
 			// Run this query on subs
-			fix_page_trail($page['page_id']);
+			fix_page_trail($page['page_id'],$root_parent);
 		}
 	}
 }
 // Fix sub-pages page trail
-fix_page_trail($page_id);
+fix_page_trail($page_id,$root_parent);
 
 /* END page "access file" code */
 
