From e04d9b864606827f1ab85c6dff94d1e3d8b48908 Mon Sep 17 00:00:00 2001 From: Friendika Date: Mon, 26 Sep 2011 23:39:47 -0700 Subject: bug #165 --- include/delivery.php | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'include/delivery.php') diff --git a/include/delivery.php b/include/delivery.php index 706c07b3b..06cc1f679 100644 --- a/include/delivery.php +++ b/include/delivery.php @@ -107,10 +107,18 @@ function delivery_run($argv, $argc){ return; } - $icontacts = q("SELECT * FROM `contact` WHERE `id` IN ( SELECT distinct(`contact-id`) FROM `item` where `parent` = %d ) ", - intval($parent_id) - ); - if(! count($icontacts)) + $icontacts = null; + $contacts_arr = array(); + foreach($items as $item) + if(! in_array($item['contact-id'],$contacts_arr)) + $contacts_arr[] = intval($item['contact-id']); + if(count($contacts_arr)) { + $str_contacts = implode(',',$contacts_arr); + $icontacts = q("SELECT * FROM `contact` + WHERE `id` IN ( $str_contacts ) " + ); + } + if( ! ($icontacts && count($icontacts))) return; -- cgit v1.2.3