From e0eb5d21f5fa1100b7cdb7d94e69fae0a0d8a473 Mon Sep 17 00:00:00 2001 From: mjollnir_ Date: Fri, 8 May 2009 14:26:17 +0000 Subject: [PATCH] fix for MDL-19110 Author: Adrian Schlegel --- course/lib.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/course/lib.php b/course/lib.php index f9276470609..2c40beb0c2e 100644 --- a/course/lib.php +++ b/course/lib.php @@ -3278,6 +3278,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; }