From dd7970b5493bf982fea5584e7381daf69f5037d2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 12 Mar 2014 12:57:26 +0100 Subject: [PATCH] Fix: Regression, so introduce option to restore old behaviour. --- htdocs/user/class/usergroup.class.php | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/htdocs/user/class/usergroup.class.php b/htdocs/user/class/usergroup.class.php index fa9290b589e8b..debf67f95ebc3 100644 --- a/htdocs/user/class/usergroup.class.php +++ b/htdocs/user/class/usergroup.class.php @@ -178,9 +178,10 @@ function listGroupsForUser($userid) * Return array of users id for group this->id (or all if this->id not defined) * * @param string $excludefilter Filter to exclude + * @param int $mode 0=Return array of user instance, 1=Return array of users id only * @return array Array of users */ - function listUsersForGroup($excludefilter='') + function listUsersForGroup($excludefilter='', $mode=0) { global $conf, $user; @@ -211,11 +212,15 @@ function listUsersForGroup($excludefilter='') { if (! array_key_exists($obj->rowid, $ret)) { - $newuser=new User($this->db); - $newuser->fetch($obj->rowid); - $ret[$obj->rowid]=$newuser; + if ($mode != 1) + { + $newuser=new User($this->db); + $newuser->fetch($obj->rowid); + $ret[$obj->rowid]=$newuser; + } + else $ret[$obj->rowid]=$obj->rowid; } - if (! empty($obj->usergroup_entity)) + if ($mode != 1 && ! empty($obj->usergroup_entity)) { $ret[$obj->rowid]->usergroup_entity[]=$obj->usergroup_entity; } @@ -744,4 +749,4 @@ function initAsSpecimen() } } -?> +?> \ No newline at end of file