Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<?php
use Bitrix\Main\Context;
require_once($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_before.php");
$request = Context::getCurrent()->getRequest();
global $APPLICATION;
$io = explode(" ", $request[data][io]);
global $USER;
$arResult = $USER->Register($request[data][emails], "", "", "123456", "123456", $request[data][emails]);
$user_id = $USER->GetID(); // ID нового пользователя
$us = new CUser;
$fields = Array(
"NAME" => $io[0],
"LAST_NAME" => $request[data][famili],
"SECOND_NAME" => $io[1],
"EMAIL" => $request[data][emails],
"LOGIN" => $request[data][emails],
"WORK_COMPANY" => $request[data][companys],
"LID" => "ru",
"ACTIVE" => "Y",
"GROUP_ID" => array(3,4),
"PASSWORD" => "123456",
"CONFIRM_PASSWORD" => "123456",
);
$us->Update($user_id, $fields);
$strError .= $us->LAST_ERROR;
//echo "<pre>"; print_r($strError); echo "<pre>";
if (CModule::IncludeModule('subscribe') && !empty($request[data]['emails'])) {
$email = $request[data]['emails'];
$subscribeFields = array(
"USER_ID" => $user_id,
"FORMAT" => "html",
"EMAIL" => $email,
"ACTIVE" => "Y",
"CONFIRMED" => "N",
"SEND_CONFIRM" => "Y",
"RUB_ID" => array(1)
);
$subscr = new CSubscription;
$ID = $subscr->Add($subscribeFields);
if($ID > 0) {
/*
if(CSubscription::ConfirmEvent($ID)):
echo "На Ваш e-mail отправлено письмо, содержащее ссылку для подтверждения электронного адреса";
endif;
*/
CSubscription::Authorize($ID);
}
}
require_once($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/epilog_after.php");
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.