Bitrix Site Manager

CUser::Register

array
CUser::Register(
 string login,
 string first_name,
 string last_name,
 string password,
 string password_confirmation,
 string email,
 string site_id = SITE_ID
)

The method Register registers and authorizes a new user and sends a message using the template NEW_USER. Returns an array with the report on processing which can be passed to ShowMessage.

Note!
The method can only be used in the public section of the site!

Parameters

ParameterDescription
login Login of a new user (at least 3 symbols).
first_name First name of a new user (can be empty).
last_name Last name of a new user (can be empty).
password Password (at least 3 symbols).
password_confirmation Password confirmation (must be equal to password for the registration to succeed).
email E-mail of a new user (at least 3 symbols). E-mail is the subject of verification by the function check_email.
site_id ID of the site whose e-mail template is to be used for the notification dispatch (NEW_USER, USER_INFO etc.).
Optional. The current site is used by default.

See Also

Example



<?
global $USER;
$arResult = $USER->Register("admin", "", "", "123456", "123456", "admin@mysite.com");
ShowMessage($arResult); // display result as a message
echo $USER->GetID(); // ID of a new user
?>