MDL-10018 Discussion for all groups not sent when groups used to users without access to all groups; backported from HEAD

This commit is contained in:
skodak
2007-06-04 21:46:12 +00:00
parent 0628867164
commit 667e06ed11
+8 -17
View File
@@ -378,26 +378,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 (!ismember($discussion->groupid) and !has_capability('moodle/site:accessallgroups', $modcontext)) {
// do not send posts from other groups when in SEPARATEGROUPS or VISIBLEGROUPS
continue;
}
}
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;
}
}
}
}
// 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);