W
W
WQP2016-09-09 16:58:28
1C-Bitrix
WQP, 2016-09-09 16:58:28

Is it possible to make a request for registration in bitrix?

Hello, I would like to know. Is it possible to make an http request for registration in bitrix? Are there service access paths?
I want to send a request from another server

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey, 2016-09-09
@gangstarcj

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);

Here is the code. Push it into a separate file, send a request to it and you're done.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question