Skip to content
Browse files

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

…ultiple
  • Loading branch information...
1 parent 0eda863 commit 5a701d1fbe0ec4f1c2ceb6cb38ccc26fa709f324 @micaherne micaherne committed Jan 11, 2013
Showing with 3 additions and 2 deletions.
  1. +3 −2 group/lib.php
View
5 group/lib.php
@@ -767,7 +767,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();
@@ -797,7 +797,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 5a701d1

Please sign in to comment.
Something went wrong with that request. Please try again.