Documentation

SimpleRegister

array
CUser::SimpleRegister(
 string USER_EMAIL,
 string site_id = SITE_ID,
 string captcha_word = "",
 string captcha_sid = 0
)

The method creates a new user by generating the random login and password. The method returns an array containing the execution report message which can be passed to ShowMessage method. Non-static method.

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

Parameters

ParameterDescription Available from version till the version
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 the mail template to send notifications (NEW_USER, USER_INFO and etc.).
Optional parameter. By default - 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->SimpleRegister("admin@mysite.com");
ShowMessage($arResult); // display result as a message
echo $USER->GetID(); // new user ID
?>


© «Bitrix24», 2001-2024
Up