AddEventHandler("main", "OnAfterUserRegister", "OnAfterUserRegisterAddGroup");
function OnAfterUserRegisterAddGroup(&$arFields)
{
if($arFields["USER_ID"]>0) {
$rsUser = CUser::GetList($by, $order,
array(
"ID" => $arFields["USER_ID"],
),
array(
"SELECT" => array(
"UF_GROUP_USER",
),
)
);
$arUser = $rsUser->Fetch();
$rsEnum = CUserFieldEnum::GetList(
array(),
array(
"ID" => $arUser["UF_GROUP_USER"],
)
);
$arEnum = $rsEnum->Fetch();
if ($arEnum["XML_ID"] === "4e148c9276c0258c211ba74857737bea") {
$arFields["GROUP_ID"][] = 8;
}elseif ($arEnum["XML_ID"] === "de1e58ea3c4e55c0e0d10707ab90e5c4") {
$arFields["GROUP_ID"][] = 15;
}
}
} |