Skip to content

Commit

Permalink
MDL-54894 comments: Get course from context if not informed
Browse files Browse the repository at this point in the history
  • Loading branch information
crazyserver committed Jun 20, 2016
1 parent 49619ce commit 6f26fcd
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion comment/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,11 @@ public function __construct(stdClass $options) {
} 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
Expand Down

0 comments on commit 6f26fcd

Please sign in to comment.