Skip to content
Browse files

Merge branch 'w31_MDL-28450_m21_defgroup' of git://github.com/skodak/…

…moodle into MOODLE_21_STABLE
  • Loading branch information...
2 parents a9fbf9f + 29a27d3 commit 31b4fdabbf322ea6b74a0020da34001307adbc61 @samhemelryk samhemelryk committed
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 {

0 comments on commit 31b4fda

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