From 141b8495e2a40dcf8c11615c2db681cd9a3d9d69 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Thu, 1 Dec 2016 14:15:34 -0800 Subject: allow plugins to cancel item_store() and item_store_update() --- include/items.php | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'include') diff --git a/include/items.php b/include/items.php index 4ac4d6049..e20c41d29 100755 --- a/include/items.php +++ b/include/items.php @@ -1463,6 +1463,11 @@ function item_store($arr, $allow_exec = false, $deliver = true) { $ret = array('success' => false, 'item_id' => 0); + if(array_key_exists('cancel',$arr) && $arr['cancel']) { + logger('cancelled by plugin'); + return $ret; + } + if(! $arr['uid']) { logger('item_store: no uid'); $ret['message'] = 'No uid.'; @@ -1881,6 +1886,12 @@ function item_store_update($arr,$allow_exec = false, $deliver = true) { $allow_exec = $d['allow_exec']; $ret = array('success' => false, 'item_id' => 0); + + if(array_key_exists('cancel',$arr) && $arr['cancel']) { + logger('cancelled by plugin'); + return $ret; + } + if(! intval($arr['uid'])) { logger('item_store_update: no uid'); $ret['message'] = 'no uid.'; -- cgit v1.2.3