Permalink
Browse files

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

…cted by default
  • Loading branch information...
1 parent 947ba9c commit 125840c2a1d3e8819a200e99779e413dca20e597 @turf212 turf212 committed with rajeshtaneja May 21, 2012
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
@@ -3845,7 +3845,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 125840c

Please sign in to comment.