Permalink
Browse files

MDL-33159 course: Fix for site wide restricted modules not being sele…

…cted by default
  • Loading branch information...
turf212 authored and Rajesh Taneja committed May 21, 2012
1 parent 33faa0d commit 6819bed8da7adeec651b535e81f0d83870969e21
Showing with 8 additions and 1 deletion.
  1. +7 −0 course/edit.php
  2. +1 −1 course/lib.php
View
@@ -85,6 +85,13 @@
//editor should respect category context if course context is not set.
$editoroptions['context'] = $catcontext;
$course = file_prepare_standard_editor($course, 'summary', $editoroptions, null, 'course', 'summary', null);
+
+ // Set up the default restricted module list
+ if (!empty($CFG->restrictbydefault)) {
+ if (!empty($CFG->defaultallowedmodules)) {
+ $course->allowedmods = explode(',', $CFG->defaultallowedmodules);
+ }
+ }
}
// first create the form
View
@@ -3778,7 +3778,7 @@ function create_course($data, $editoroptions = NULL) {
fix_course_sortorder();
// update module restrictions
- if ($course->restrictmodules) {
+ if ($course->restrictmodules || $CFG->restrictbydefault ) {
if (isset($data->allowedmods)) {
update_restricted_mods($course, $data->allowedmods);
} else {

0 comments on commit 6819bed

Please sign in to comment.