From 648b6fd759a88a5833581467ed231ee9ba7a80e8 Mon Sep 17 00:00:00 2001 From: nathangray Date: Mon, 24 Oct 2016 09:21:57 -0600 Subject: [PATCH] If searching for an account and you include 'Group ' (or translation) in the search string, it will search just groups instead of all accounts. --- api/src/Accounts.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/api/src/Accounts.php b/api/src/Accounts.php index 7669fc4bce..d83992c2c8 100644 --- a/api/src/Accounts.php +++ b/api/src/Accounts.php @@ -197,6 +197,15 @@ class Accounts //error_log(__METHOD__.'('.array2string($param).') '.function_backtrace()); if (!isset($param['active'])) $param['active'] = true; // default is true = only return active accounts + // Check for lang(Group) in search - if there, we search all groups + $group_index = array_search(strtolower(lang('Group')), array_map('strtolower', $query = explode(' ',$param['query']))); + if($group_index !== FALSE) + { + $param['type'] = 'groups'; + // Remove the 'group' from the query, but only one (eg: Group NoGroup -> NoGroup) + unset($query[$group_index]); + $param['query'] = implode(' ', $query); + } self::setup_cache(); $account_search = &self::$cache['account_search']; $serial = serialize($param);