diff --git a/lib.php b/lib.php index 4d780a3..2376047 100644 --- a/lib.php +++ b/lib.php @@ -364,7 +364,7 @@ function subcourse_get_coursemodule_info($coursemodule) { global $CFG, $DB; $subcourse = $DB->get_record('subcourse', ['id' => $coursemodule->instance], - 'id, name, intro, introformat, instantredirect, blankwindow, coursepageprintgrade, coursepageprintprogress'); + 'id, name, intro, introformat, instantredirect, blankwindow, coursepageprintgrade, coursepageprintprogress, completioncourse'); if (!$subcourse) { return null; @@ -387,6 +387,12 @@ function subcourse_get_coursemodule_info($coursemodule) { $info->content = format_module_intro('subcourse', $subcourse, $coursemodule->id, false); } + // Populate the custom completion rules as key => value pairs, but only if the completion mode is 'automatic'. + if ($coursemodule->completion == COMPLETION_TRACKING_AUTOMATIC) { + $info->customdata->customcompletionrules['completioncourse'] = $subcourse->completioncourse; + } + + return $info; }