Permalink
Browse files

MDL-27164 groups Do not show multiple instances of the same role as m…

…ultiple
  • Loading branch information...
1 parent 9b7b6fa commit 53c07f1644511b9a6c151f1f5f413f04f0f77bb5 @micaherne micaherne committed Jan 11, 2013
Showing with 3 additions and 2 deletions.
  1. +3 −2 group/lib.php
View
5 group/lib.php
@@ -846,7 +846,7 @@ function groups_calculate_role_people($rs, $context) {
$roles[$roledata->id] = $roledata;
}
// Record that user has role
- $users[$rec->userid]->roles[] = $roles[$rec->roleid];
+ $users[$rec->userid]->roles[$rec->roleid] = $roles[$rec->roleid];
}
}
$rs->close();
@@ -876,7 +876,8 @@ function groups_calculate_role_people($rs, $context) {
} else if($rolecount > 1) {
$roleid = '*';
} else {
- $roleid = $userdata->roles[0]->id;
+ $userrole = reset($userdata->roles);
+ $roleid = $userrole->id;
}
$roles[$roleid]->users[$userid] = $userdata;
}

0 comments on commit 53c07f1

Please sign in to comment.