MDL-35619 fix invalid avatars on other users page
authorPetr Škoda <commits@skodak.org>
Mon, 1 Oct 2012 07:51:12 +0000 (09:51 +0200)
committerPetr Škoda <commits@skodak.org>
Mon, 1 Oct 2012 07:51:12 +0000 (09:51 +0200)
enrol/locallib.php

index 41b7337..e923c2e 100644 (file)
@@ -766,13 +766,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;