diff --git a/cohort/edit_form.php b/cohort/edit_form.php index fe3ce492461..957607171c8 100644 --- a/cohort/edit_form.php +++ b/cohort/edit_form.php @@ -98,7 +98,7 @@ class cohort_edit_form extends moodleform { $options[$syscontext->id] = print_context_name($syscontext); } foreach ($displaylist as $cid=>$name) { - $context = context_coursecat::instance($cid, MUST_EXIST); + $context = context_coursecat::instance($cid); $options[$context->id] = $name; } // always add current - this is not likely, but if the logic gets changed it might be a problem diff --git a/cohort/lib.php b/cohort/lib.php index ce512729766..223644b52e6 100644 --- a/cohort/lib.php +++ b/cohort/lib.php @@ -110,10 +110,10 @@ function cohort_delete_category($category) { global $DB; // TODO: make sure that cohorts are really, really not used anywhere and delete, for now just move to parent or system context - $oldcontext = context_coursecat::instance($category->id, MUST_EXIST); + $oldcontext = context_coursecat::instance($category->id); if ($category->parent and $parent = $DB->get_record('course_categories', array('id'=>$category->parent))) { - $parentcontext = context_coursecat::instance($parent->id, MUST_EXIST); + $parentcontext = context_coursecat::instance($parent->id); $sql = "UPDATE {cohort} SET contextid = :newcontext WHERE contextid = :oldcontext"; $params = array('oldcontext'=>$oldcontext->id, 'newcontext'=>$parentcontext->id); } else { @@ -165,7 +165,7 @@ function cohort_remove_member($cohortid, $userid) { function cohort_get_visible_list($course) { global $DB, $USER; - $context = context_course::instance($course->id, MUST_EXIST); + $context = context_course::instance($course->id); list($esql, $params) = get_enrolled_sql($context); $parentsql = get_related_contexts_string($context);