MDL-26476 fix incorrect fetching of user groups in modinfo
authorPetr Skoda <commits@skodak.org>
Thu, 17 Feb 2011 17:19:41 +0000 (18:19 +0100)
committerPetr Skoda <commits@skodak.org>
Thu, 17 Feb 2011 17:19:41 +0000 (18:19 +0100)
lib/modinfolib.php

index 8785e50..50888fb 100644 (file)
@@ -906,8 +906,8 @@ class cm_info extends stdClass  {
         } else if (!empty($CFG->enablegroupmembersonly) and !empty($this->groupmembersonly)
                 and !has_capability('moodle/site:accessallgroups', $modcontext, $userid)) {
             // If the activity has 'group members only' and you don't have accessallgroups...
-            $groups = $this->modinfo->get_groups();
-            if (empty($this->groups[$this->groupingid])) {
+            $groups = $this->modinfo->get_groups($this->groupingid);
+            if (empty($groups)) {
                 // ...and you don't belong to a group, then set it so you can't see/access it
                 $this->uservisible = false;
             }