Bitrix Site Manager

CUser::SetUserGroupArray

CUser::SetUserGroupArray(
   array groups
);

The method SetUserGroupArray assigns a user to a number of groups (usually called on the $USER object). The assignment is not stored in the database and will not be restored upon further authorizations. To store the assignment in the database, use the method CUser::SetUserGroup.

Parameters

Parameter Description
groups Array containing the ID's of the user groups.

See Also

Example



<?
// assign the current user to a group with ID=5
global $USER;
$arGroups = $USER->GetUserGroupArray();
$arGroups[] = 5;
$USER->SetUserGroupArray($arGroups);
?>