Skip to content

Commit

Permalink
MDL-24590 fixed links to groups on participants page
Browse files Browse the repository at this point in the history
  • Loading branch information
skodak committed Oct 9, 2010
1 parent fe7131d commit a732add
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions user/view.php
Original file line number Diff line number Diff line change
Expand Up @@ -246,12 +246,23 @@

// Show groups this user is in
if (!isset($hiddenfields['groups'])) {
if ($course->groupmode != SEPARATEGROUPS or has_capability('moodle/site:accessallgroups', $coursecontext)) {
if ($usergroups = groups_get_all_groups($course->id, $user->id)) {
$groupstr = '';
foreach ($usergroups as $group){
$accessallgroups = has_capability('moodle/site:accessallgroups', $coursecontext);
if ($usergroups = groups_get_all_groups($course->id, $user->id)) {
$groupstr = '';
foreach ($usergroups as $group){
if ($course->groupmode == SEPARATEGROUPS and !$accessallgroups and $user->id != $USER->id) {
if (!groups_is_member($group->id, $user->id)) {
continue;
}
}

if ($course->groupmode != NOGROUPS) {
$groupstr .= ' <a href="'.$CFG->wwwroot.'/user/index.php?id='.$course->id.'&amp;group='.$group->id.'">'.format_string($group->name).'</a>,';
} else {
$groupstr .= ' '.format_string($group->name); // the user/index.php shows groups only when course in group mode
}
}
if ($groupstr !== '') {
print_row(get_string("group").":", rtrim($groupstr, ', '));
}
}
Expand Down

0 comments on commit a732add

Please sign in to comment.