Answer the question
In order to leave comments, you need to log in
Bitrix CUser::GetList how to select all users except administrators?
The documentation says that there is no complex filtering logic for GROUPS_ID, i.e. just an array with the desired groups.
And how to exclude the desired group from the sample? for example, you need a list of users that does not include Administrators?
$filterUser = array(
"ACTIVE" => 'Y',
// "!GROUPS_ID"=>[1] -- так не будет фильтровать
);
$userResult = CUser::GetList(($by="NAME"), ($order="ASC"), $filterUser);
Answer the question
In order to leave comments, you need to log in
this is the moment when you do not need to use the ancient api, there is \Bitrix\Main\UserGroupTable
Select the identifiers of all groups, remove the identifier of the administrator group from the resulting array, filter by the remaining ones.
The output is an array without admins
<?
global $USER;
$users = CUser::GetList(
($by="id"),
($order="desc"),
array(),
array("SELECT" => array('*'))
);
$userArray = array();
$arrayGroupIds = array();
while ($user = $users->Fetch()) {
if (in_array(1, CUser::GetUserGroup($user['ID'])))
{
} else {
$userArray [] =$user;
}
}
?>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question