From 38bd362af1292892d43a2d467f17e4283e0201f8 Mon Sep 17 00:00:00 2001 From: skodak Date: Mon, 4 Jun 2007 21:43:57 +0000 Subject: [PATCH] MDL-10018 Discussion for all groups not sent when groups used to users without access to all groups --- mod/forum/lib.php | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/mod/forum/lib.php b/mod/forum/lib.php index f6c4c65f6e..1f7201eb3e 100644 --- a/mod/forum/lib.php +++ b/mod/forum/lib.php @@ -392,26 +392,17 @@ function forum_cron() { course_setup($course); // More environment // Make sure groups allow this user to see this email - $groupmode = false; - if (!empty($cm->id)) { - if ($groupmode = groupmode($course, $cm) and $discussion->groupid > 0) { // Groups are being used - if (! groups_group_exists($discussion->groupid)) { // Can't find group //TODO: - continue; // Be safe and don't send it to anyone - } + if ($discussion->groupid > 0 and $groupmode = groupmode($course, $cm)) { // Groups are being used + if (! groups_group_exists($discussion->groupid)) { // Can't find group + continue; // Be safe and don't send it to anyone } - } - if ($groupmode) { // Look for a reason not to send this email - if (!empty($discussion->groupid)) { - if (!ismember($discussion->groupid, $userto->id)) { - if (!has_capability('moodle/site:accessallgroups', $modcontext)) { - continue; - } - } + if (!ismember($discussion->groupid) and !has_capability('moodle/site:accessallgroups', $modcontext)) { + // do not send posts from other groups when in SEPARATEGROUPS or VISIBLEGROUPS + continue; } } - // Make sure we're allowed to see it... if (!forum_user_can_see_post($forum, $discussion, $post)) { mtrace('user '.$userto->id. ' can not see '.$post->id); -- 2.39.5