MDL-54894 comments: Get course from context if not informed

This commit is contained in:
Pau Ferrer Ocaña
2016-06-20 08:58:05 +02:00
parent 49619ce243
commit 6f26fcd7e0
+5 -1
View File
@@ -153,7 +153,11 @@ class comment {
} else if (!empty($options->courseid)) {
$this->courseid = $options->courseid;
} else {
$this->courseid = SITEID;
if ($coursecontext = $this->context->get_course_context(false)) {
$this->courseid = $coursecontext->instanceid;
} else {
$this->courseid = SITEID;
}
}
// setup coursemodule