diff --git a/enrol/locallib.php b/enrol/locallib.php index 596320a7ee6..bca932a8070 100644 --- a/enrol/locallib.php +++ b/enrol/locallib.php @@ -787,13 +787,15 @@ class course_enrolment_manager { $users = array(); foreach ($userroles as $userrole) { + $contextid = $userrole->contextid; + unset($userrole->contextid); // This would collide with user avatar. if (!array_key_exists($userrole->id, $users)) { $users[$userrole->id] = $this->prepare_user_for_display($userrole, $extrafields, $now); } $a = new stdClass; $a->role = $roles[$userrole->roleid]->localname; $changeable = ($userrole->component == ''); - if ($userrole->contextid == $this->context->id) { + if ($contextid == $this->context->id) { $roletext = get_string('rolefromthiscourse', 'enrol', $a); } else { $changeable = false;