Merge branch 'w41_MDL-42047_m26_cohortdel' of https://github.com/skodak/moodle
authorDamyon Wiese <damyon@moodle.com>
Wed, 9 Oct 2013 06:42:23 +0000 (14:42 +0800)
committerDamyon Wiese <damyon@moodle.com>
Wed, 9 Oct 2013 06:42:23 +0000 (14:42 +0800)
enrol/cohort/lib.php

index 6ab0402..ef6d5ae 100644 (file)
@@ -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));