Students cannot see other student announcements see BT#10970

1.10.x
jmontoya 9 years ago
parent 4e928ba16c
commit b39cecc9b6
  1. 13
      main/inc/lib/AnnouncementManager.php

@ -1524,9 +1524,9 @@ class AnnouncementManager
} }
} else { } else {
// STUDENT // STUDENT
if (is_array($group_memberships) && count($group_memberships)>0) { if (is_array($group_memberships) && count($group_memberships) > 0) {
if ($allowUserEditSetting && !api_is_anonymous()) { if ($allowUserEditSetting && !api_is_anonymous()) {
if (api_get_group_id() == 0) { if ($group_id == 0) {
// No group // No group
$cond_user_id = " AND ( $cond_user_id = " AND (
ip.lastedit_user_id = '".$user_id."' OR ( ip.lastedit_user_id = '".$user_id."' OR (
@ -1540,13 +1540,13 @@ class AnnouncementManager
)"; )";
} }
} else { } else {
if (api_get_group_id() == 0) { if ($group_id == 0) {
$cond_user_id = " AND ( $cond_user_id = " AND (
ip.to_user_id=$user_id OR (ip.to_group_id IS NULL OR ip.to_group_id IN (0, ".implode(", ", $group_memberships).")) ip.to_user_id = $user_id AND (ip.to_group_id IS NULL OR ip.to_group_id IN (0, ".implode(", ", $group_memberships)."))
) "; ) ";
} else { } else {
$cond_user_id = " AND ( $cond_user_id = " AND (
ip.to_user_id=$user_id OR (ip.to_group_id IS NULL OR ip.to_group_id IN (0, ".api_get_group_id().")) ip.to_user_id = $user_id AND (ip.to_group_id IS NULL OR ip.to_group_id IN (0, ".$group_id."))
)"; )";
} }
} }
@ -1565,6 +1565,7 @@ class AnnouncementManager
AND ip.visibility='1' AND ip.visibility='1'
ORDER BY display_order DESC"; ORDER BY display_order DESC";
} else { } else {
if ($user_id) { if ($user_id) {
if ($allowUserEditSetting && !api_is_anonymous()) { if ($allowUserEditSetting && !api_is_anonymous()) {
$cond_user_id = " AND ( $cond_user_id = " AND (
@ -1586,7 +1587,7 @@ class AnnouncementManager
$condition_session $condition_session
$searchCondition $searchCondition
AND ip.visibility='1' AND ip.visibility='1'
AND announcement.session_id IN(0, ".api_get_session_id().") AND announcement.session_id IN(0, ".$session_id.")
ORDER BY display_order DESC"; ORDER BY display_order DESC";
} else { } else {

Loading…
Cancel
Save