diff --git a/calendar/inc/class.bocal.inc.php b/calendar/inc/class.bocal.inc.php index ff22473ca2..6d1e2618a6 100644 --- a/calendar/inc/class.bocal.inc.php +++ b/calendar/inc/class.bocal.inc.php @@ -343,8 +343,17 @@ class bocal $this->total = $this->so->total; $this->db2data($events,isset($params['date_format']) ? $params['date_format'] : 'ts'); + // socal::search() returns rejected group-invitations, as only the user not also the group is rejected + // as we cant remove them efficiantly in SQL, we kick them out here, but only if just one user is displayed + $remove_rejected_by_user = !$show_rejected && count($params['users']) == 1 ? $params['users'][0] : false; + //echo "

remove_rejected_by_user=$remove_rejected_by_user, show_rejected=$show_rejected, params[users]=".print_r($param['users'])."

\n"; foreach($events as $id => $event) { + if ($remove_rejected_by_user && $event['participants'][$remove_rejected_by_user] == 'R') + { + unset($events[$id]); // remove the rejected event + continue; + } if ($params['enum_groups'] && $this->enum_groups($event)) { $events[$id] = $event;