MDL-39947 mod_forum: Add safety check to variable assignment when counting unread posts

This commit is contained in:
Adam Olley
2013-05-31 09:50:35 +09:30
parent ae61eea349
commit 752fb7113d
+5 -1
View File
@@ -6741,7 +6741,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)) {