Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

MDL-39947 mod_forum: Add safety check to variable assignment when cou…

…nting unread posts
  • Loading branch information...
commit f985bc4e65866562606acffe42da5d1dd57d2722 1 parent b6f8a93
Adam Olley aolley authored
Showing with 5 additions and 1 deletion.
  1. +5 −1 mod/forum/lib.php
6 mod/forum/lib.php
View
@@ -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)) {
Please sign in to comment.
Something went wrong with that request. Please try again.