From 483916069cc55c3007f1e655a5e2a5e53eb535b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20S=CC=8Ckoda?= Date: Sun, 29 Sep 2013 15:32:06 +0200 Subject: [PATCH] MDL-42047 fix cohort method name error after deleting cohort --- enrol/cohort/lib.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/enrol/cohort/lib.php b/enrol/cohort/lib.php index 6ab0402bcc5..ef6d5ae8675 100644 --- a/enrol/cohort/lib.php +++ b/enrol/cohort/lib.php @@ -46,6 +46,9 @@ class enrol_cohort_plugin extends enrol_plugin { } else if (empty($instance->name)) { $enrol = $this->get_name(); $cohort = $DB->get_record('cohort', array('id'=>$instance->customint1)); + if (!$cohort) { + return get_string('pluginname', 'enrol_'.$enrol); + } $cohortname = format_string($cohort->name, true, array('context'=>context::instance_by_id($cohort->contextid))); if ($role = $DB->get_record('role', array('id'=>$instance->roleid))) { $role = role_get_name($role, context_course::instance($instance->courseid, IGNORE_MISSING));