Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

MDL-28450 prefer member group for default

  • Loading branch information...
commit 29a27d3ca49582c23a419e07fda2dbc79c1ca90c 1 parent 80eb52c
@skodak skodak authored
Showing with 6 additions and 2 deletions.
  1. +6 −2 lib/grouplib.php
View
8 lib/grouplib.php
@@ -717,7 +717,7 @@ function groups_course_module_visible($cm, $userid=null) {
* @return void
*/
function _group_verify_activegroup($courseid, $groupmode, $groupingid, array $allowedgroups) {
- global $SESSION;
+ global $SESSION, $USER;
// init activegroup array if necessary
if (!isset($SESSION->activegroup)) {
@@ -742,7 +742,11 @@ function _group_verify_activegroup($courseid, $groupmode, $groupingid, array $al
$SESSION->activegroup[$courseid][$groupmode][$groupingid] = 0; // all groups by default if user has accessallgroups
} else if ($allowedgroups) {
- $firstgroup = reset($allowedgroups);
+ if ($groupmode != SEPARATEGROUPS and $mygroups = groups_get_all_groups($courseid, $USER->id, $groupingid)) {
+ $firstgroup = reset($mygroups);
+ } else {
+ $firstgroup = reset($allowedgroups);
+ }
$SESSION->activegroup[$courseid][$groupmode][$groupingid] = $firstgroup->id;
} else {
Please sign in to comment.
Something went wrong with that request. Please try again.