]> git.mjollnir.org Git - moodle.git/commitdiff
fix for MDL-19110
authormjollnir_ <mjollnir_>
Fri, 8 May 2009 14:24:56 +0000 (14:24 +0000)
committermjollnir_ <mjollnir_>
Fri, 8 May 2009 14:24:56 +0000 (14:24 +0000)
Author: Adrian Schlegel <adrian@liip.ch>

course/lib.php

index 8ab86c2eccc7557803858c34ac57e20ac89a4e44..aff3060f331241b96a5a340f6e561e58538ba6fd 100644 (file)
@@ -3522,6 +3522,14 @@ function create_course($data) {
     unset($data->allowedmods);
     if ($CFG->restrictmodulesfor == 'all') {
         $data->restrictmodules = 1;
+
+        // if the user is not an admin, get the default allowed modules because
+        // there are no modules passed by the form
+        if(!has_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM))) {
+            if(!$allowedmods && $CFG->defaultallowedmodules) {
+                $allowedmods = explode(',', $CFG->defaultallowedmodules);
+            }
+        }
     } else {
         $data->restrictmodules = 0;
     }