Answer the question
In order to leave comments, you need to log in
Answer the question
In order to leave comments, you need to log in
For user registration? Yes, you can
0) If you need to register, but not activate the user, you can simply add him programmatically
1) Create a mail event and a template
2) Send a mail event with the necessary data to the admin email
<? require($_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/main/include/prolog_before.php');
if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) die();
parse_str($_POST['serialize'], $post);
CModule::IncludeModule("main");
$user = new CUser;
$password = md5(rand(1000, 100000) . HASH);
$fio = explode(' ', $post['FIO_USER']);
$arFields = Array(
"NAME" => $fio[0],
"LAST_NAME" => $fio[1],
"SECOND_NAME" => $fio[2],
"EMAIL" => $post['EMAIL'],
"LOGIN" => $post['EMAIL'],
"LID" => "ru",
"ACTIVE" => "N",
"GROUP_ID" => array(5,6),
"PASSWORD" => $password,
"CONFIRM_PASSWORD" => $password,
);
$ID = $user->Add($arFields);
if (intval($ID) > 0) {
$STATUS['CODE'] = "OK";
$arEventFields = array(
'USER_ID' => $ID,
"NAME" => $post['FIO_USER'],
"EMAIL" => $post['EMAIL'],
);
CEvent::Send("USER_NEED_REGISTER", 's1', $arEventFields);
} else {
$STATUS['CODE'] = 'ERROR';
$STATUS['TEXT'] = $user->LAST_ERROR;
}
echo json_encode($STATUS);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question