Merge branch 'MDL-39947' of https://github.com/aolley/moodle
authorDan Poltawski <dan@moodle.com>
Mon, 10 Jun 2013 08:19:56 +0000 (16:19 +0800)
committerDan Poltawski <dan@moodle.com>
Mon, 10 Jun 2013 08:19:56 +0000 (16:19 +0800)
mod/forum/lib.php

index 0e3935a..9473987 100644 (file)
@@ -6760,7 +6760,11 @@ function forum_tp_count_forum_unread_posts($cm, $course) {
         $modinfo->groups = groups_get_user_groups($course->id, $USER->id);
     }
 
-    $mygroups = $modinfo->groups[$cm->groupingid];
+    if (array_key_exists($cm->groupingid, $modinfo->groups)) {
+        $mygroups = $modinfo->groups[$cm->groupingid];
+    } else {
+        $mygroups = false; // Will be set below
+    }
 
     // add all groups posts
     if (empty($mygroups)) {