public static function OnAfterUserRegister($arFields) { global $DB; $err_mess = CRatings::err_mess() . "<br>Function: OnAfterUserRegister<br>Line: "; $userId = isset($arFields["USER_ID"]) ? intval($arFields["USER_ID"]) : (isset($arFields["ID"]) ? intval($arFields["ID"]) : 0); if ($userId > 0) { $authorityRatingId = CRatings::GetAuthorityRating(); $ratingStartValue = COption::GetOptionString("main", "rating_start_authority", 3); $ratingCountVote = COption::GetOptionString("main", "rating_count_vote", 10); $arParam = array('RATING_ID' => $authorityRatingId, 'ENTITY_ID' => $userId, 'BONUS' => intval($ratingStartValue), 'VOTE_WEIGHT' => intval($ratingStartValue) * COption::GetOptionString("main", "rating_vote_weight", 1), 'VOTE_COUNT' => intval($ratingCountVote) + intval($ratingStartValue)); CRatings::UpdateRatingUserBonus($arParam); if (IsModuleInstalled("intranet")) { $strSql = "INSERT INTO b_rating_subordinate (RATING_ID, ENTITY_ID, VOTES) VALUES ('" . $authorityRatingId . "', '" . $userId . "', '" . (intval($ratingCountVote) + intval($ratingStartValue)) . "')"; $DB->Query($strSql, false, $err_mess . __LINE__); } $sRatingAssignType = COption::GetOptionString("main", "rating_assign_type", 'manual'); if ($sRatingAssignType == 'auto') { $assignRatingGroup = COption::GetOptionString("main", "rating_assign_rating_group", 0); $assignAuthorityGroup = COption::GetOptionString("main", "rating_assign_authority_group", 0); if ($assignRatingGroup == 0 && $assignAuthorityGroup == 0) { return false; } $arGroups = array(); $res = CUser::GetUserGroupList($userId); while ($res_arr = $res->Fetch()) { $arGroups[] = array("GROUP_ID" => $res_arr["GROUP_ID"], "DATE_ACTIVE_FROM" => $res_arr["DATE_ACTIVE_FROM"], "DATE_ACTIVE_TO" => $res_arr["DATE_ACTIVE_TO"]); } if ($assignRatingGroup > 0) { $arGroups[] = array("GROUP_ID" => intval($assignRatingGroup)); } if ($assignAuthorityGroup > 0 && $assignRatingGroup != $assignAuthorityGroup) { $arGroups[] = array("GROUP_ID" => intval($assignAuthorityGroup)); } CUser::SetUserGroup($userId, $arGroups); } if (CACHED_b_rating_vote !== false) { global $CACHE_MANAGER; $bucket_size = intval(CACHED_b_rating_bucket_size); if ($bucket_size <= 0) { $bucket_size = 100; } $bucket = intval($userId / $bucket_size); $CACHE_MANAGER->Clean("b_rvu_" . $authorityRatingId . $bucket, "b_rating_user"); } } }
$USER_FIELD_MANAGER->EditFormAddFields($PROPERTY_ID, $arFields); if ($ID > 0 && $COPY_ID <= 0) { $res = $user->Update($ID, $arFields, true); } elseif ($USER->CanDoOperation('edit_all_users') || $USER->CanDoOperation('edit_subordinate_users')) { $ID = $user->Add($arFields); $res = $ID > 0; if (COption::GetOptionString("main", "event_log_register", "N") === "Y" && $res) { $res_log["user"] = $_POST["NAME"] != "" || $_POST["LAST_NAME"] != "" ? trim($_POST["NAME"] . " " . $_POST["LAST_NAME"]) : $_POST["LOGIN"]; CEventLog::Log("SECURITY", "USER_REGISTER", "main", $ID, serialize($res_log)); } $new = "Y"; } if ($USER->CanDoOperation('edit_ratings') && ($selfEdit || $ID != $USER->GetID()) && is_array($_POST['RATING_BONUS'])) { foreach ($_POST['RATING_BONUS'] as $ratingId => $ratingBonus) { $arParam = array('RATING_ID' => $ratingId, 'ENTITY_ID' => $ID, 'BONUS' => $ratingBonus); CRatings::UpdateRatingUserBonus($arParam); } } $strError .= $user->LAST_ERROR; if ($APPLICATION->GetException()) { $err = $APPLICATION->GetException(); $strError .= $err->GetString(); $APPLICATION->ResetException(); } } if ($strError == '' && $ID > 0) { if (is_array($_REQUEST["profile_module_id"]) && count($_REQUEST["profile_module_id"]) > 0) { $db_opt_res = CModule::GetList(); while ($opt_res = $db_opt_res->Fetch()) { if (in_array($opt_res["ID"], $_REQUEST["profile_module_id"])) { $mdir = $opt_res["ID"];