]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-10018 Discussion for all groups not sent when groups used to users without access...
authorskodak <skodak>
Mon, 4 Jun 2007 21:43:57 +0000 (21:43 +0000)
committerskodak <skodak>
Mon, 4 Jun 2007 21:43:57 +0000 (21:43 +0000)
mod/forum/lib.php

index f6c4c65f6e64ab782d51c6ac411a2c7d3123a6bc..1f7201eb3edf694feaabd7a39c6baad439707c06 100644 (file)
@@ -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);