If searching for an account and you include 'Group ' (or translation) in the search string, it will search just groups instead of all accounts.

This commit is contained in:
nathangray 2016-10-24 09:21:57 -06:00
parent a51fdfbc81
commit 648b6fd759

View File

@ -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);