Documentation

Register

array
CUser::Register(
 string USER_LOGIN,
 string USER_NAME,
 string USER_LAST_NAME,
 string USER_PASSWORD,
 string USER_CONFIRM_PASSWORD,
 string USER_EMAIL,
 string site_id = false,
 string captcha_word = "",
 string captcha_sid = 0
)

The method 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 function. Non-static method.

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

Parameters

ParameterDescription Available from version
USER_LOGIN Login of a new user (at least 3 symbols).
USER_NAME First name of a new user (can be empty).
USER_LAST_NAME Last name of a new user (can be empty).
USER_PASSWORD Password (at least 3 symbols).
USER_CONFIRM_PASSWORD Password confirmation (must be equal to password for the registration to succeed).
USER_EMAIL E-mail of a new user (at least 3 symbols). E-mail is the subject of verification by the check_email function.
site_id Site ID for email template to send notifications (NEW_USER, USER_INFO and etc.).
Optional parameter. By default value - "false", which means the current site.
captcha_word Word for CAPTCHA. Added if the main module settings has the flag "use CAPTCHA during registration" checked. If this option is not specified, the following is returned: "Word for protection from automatic registration is incorrect".
captcha_sid The CAPTCHA ID. Added if the main module settings has the flag "use CAPTCHA during registration" checked. If this option is not specified, the following is returned: "Word for protection from automatic registration is incorrect".

See Also

Examples of use

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


© «Bitrix24», 2001-2022
Up