Documentation

SetUserGroupArray

CUser::SetUserGroupArray(
   array groups
);

The method assigns the current user to a number of groups (usually called on the $USER object). The data is retrieved from session variable, which value corresponds to the user assignment at the moment of authorization. This assignment to groups 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. Non-static method.

Parameters

Parameter Description
groups Array with user groups IDs.

See Also

Examples of use

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


© «Bitrix24», 2001-2024