From 3dad86f0e0a4b49a349b98ea05f721d16ed7d725 Mon Sep 17 00:00:00 2001 From: rabuzarus <> Date: Thu, 28 Apr 2016 22:15:55 +0200 Subject: [PATCH 1/2] add a hook call to acl_lookup() --- include/acl_selectors.php | 31 ++++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/include/acl_selectors.php b/include/acl_selectors.php index 65f125b852..fc3df52327 100644 --- a/include/acl_selectors.php +++ b/include/acl_selectors.php @@ -637,22 +637,35 @@ function acl_lookup(&$a, $out_type = 'json') { $tot += count($unknow_contacts); } + $results = array( + "tot" => $tot, + "start" => $start, + "count" => $count, + "groups" => $groups, + "contacts" => $contacts, + "items" => $items, + "type" => $type, + "search" => $search, + ); + + call_hooks('acl_lookup_end', $results); + if($out_type === 'html') { $o = array( - 'tot' => $tot, - 'start' => $start, - 'count' => $count, - 'groups' => $groups, - 'contacts' => $contacts, + 'tot' => $results["tot"], + 'start' => $results["start"], + 'count' => $results["count"], + 'groups' => $results["groups"], + 'contacts' => $results["contacts"], ); return $o; } $o = array( - 'tot' => $tot, - 'start' => $start, - 'count' => $count, - 'items' => $items, + 'tot' => $results["tot"], + 'start' => $results["start"], + 'count' => $results["count"], + 'items' => $results["items"], ); echo json_encode($o); From a61361f351ae0d1ac8cbf54b09387c411a4e7537 Mon Sep 17 00:00:00 2001 From: rabuzarus <> Date: Thu, 28 Apr 2016 23:18:38 +0200 Subject: [PATCH 2/2] add some hook docu --- doc/Plugins.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/doc/Plugins.md b/doc/Plugins.md index a30a3f4a71..49d0665fec 100644 --- a/doc/Plugins.md +++ b/doc/Plugins.md @@ -281,6 +281,11 @@ $b is an array with: 'template' => filename of template 'vars' => array of vars passed to template +### ''acl_lookup_end' +is called after the other queries have passed. +The registered function can add, change or remove the acl_lookup() variables. + + 'results' => array of the acl_lookup() vars Complete list of hook callbacks @@ -338,6 +343,8 @@ include/acl_selectors.php: call_hooks($a->module . '_pre_' . $selname, $arr); include/acl_selectors.php: call_hooks($a->module . '_post_' . $selname, $o); +include/acl_selectors.php call_hooks('acl_lookup_end', $results); + include/notifier.php: call_hooks('notifier_normal',$target_item); include/notifier.php: call_hooks('notifier_end',$target_item);