--- moodle/admin/index.php	2007-03-15 13:10:02.000000000 +0000
+++ public_html/admin/index.php	2007-04-16 21:19:58.000000000 +0100
@@ -522,6 +522,12 @@
         }
     }
 
+/// Check if there are any new admin settings which have still yet to be set
+
+    if( any_new_admin_settings( admin_get_root()) ){
+        redirect('upgradesettings.php');
+    }
+
 /// Everything should now be set up, and the user is an admin
 
 /// Print default admin page with notifications.
@@ -608,5 +614,38 @@
 
     admin_externalpage_print_footer($adminroot);
 
+/**
+ * Based on find_new_settings{@link ()}  in upgradesettings.php
+ * Looks to find any admin settings that have not been initialized. Returns 1 if it finds any.
+ *
+ * @param string &$node The node at which to start searching. 
+ * @return int Returns 1 if any settings haven't been initialised, 0 if they all have
+ */
+function any_new_admin_settings(&$node) {
+
+    if (is_a($node, 'admin_category')) {
+        $entries = array_keys($node->children);
+        foreach ($entries as $entry) {
+            if( any_new_admin_settings($node->children[$entry]) ){
+                return 1;
+            }
+        }
+    }
+
+    if (is_a($node, 'admin_settingpage')) {
+        foreach ($node->settings as $setting) {
+            if ($setting->get_setting() === NULL) {
+                return 1;
+            }
+            unset($setting); // needed to prevent odd (imho) reference behaviour
+                             // see http://www.php.net/manual/en/language.references.whatdo.php#AEN6399
+        }
+    }
+
+
+    return 0;
+
+}
+
 
 ?>

