Added get some user field into the function 'users_get_user_users'

This commit is contained in:
mdtrooper 2014-09-16 17:53:50 +02:00
parent 72257865b5
commit 71d472b6e6
1 changed files with 16 additions and 5 deletions

View File

@ -818,17 +818,28 @@ function users_can_manage_group_all($id_group = 0, $access = "PM") {
*
* @return mixed Array with id_user as index and value
*/
function users_get_user_users($id_user = false, $privilege = "AR", $returnAllGroup = true) {
function users_get_user_users($id_user = false, $privilege = "AR",
$returnAllGroup = true, $fields = null) {
global $config;
$user_groups = users_get_groups($id_user, $privilege, $returnAllGroup);
$user_users = array();
foreach($user_groups as $id_user_group => $name_user_group) {
foreach ($user_groups as $id_user_group => $name_user_group) {
$group_users = groups_get_users($id_user_group, false, $returnAllGroup);
foreach($group_users as $gu) {
$user_users[$gu['id_user']] = $gu['id_user'];
foreach ($group_users as $gu) {
if (empty($fields)) {
$user_users[$gu['id_user']] = $gu['id_user'];
}
else {
$fields = (array)$fields;
foreach ($fields as $field) {
$user_users[$gu['id_user']][$field] = $gu[$field];
}
}
}
}