Bitrix Site Manager

OnAfterUserSimpleRegister event

event_handler(
 array &arFields,
);

The OnAfterUserSimpleRegister event fires after a attempt of user simplified registration performed by CUser::SimpleRegister.

Parameters

ParameterDescription
arFields Array of user registration fields:
  • USER_ID - if the registration succeeds, contains the user ID;
  • RESULT_MESSAGE - array containing the verification result description (can be passed to ShowMessage to display a message);
  • PASSWORD - password;
  • CONFIRM_PASSWORD - password confirmation;
  • CHECKWORD - new check word for password change;
  • EMAIL - user e-mail;
  • ACTIVE - active state flag [Y|N]
  • SITE_ID - the ID of default site used for notifications;
  • GROUP_ID - array of user group ID's;
  • USER_IP - user IP address;
  • USER_HOST - user host name.

Note
All parameters passed to this handler function are references to original variables. Therefore, all changes to parameters made within the handler affect values of the original variables.

For example, this allows to modify the RESULT_MESSAGE, which will change message returned by the method CUser::Login.

See Also

Example of handler registration


<?
// register handler OnAfterUserSimpleRegister
RegisterModuleDependences("main", 
                          "OnAfterUserSimpleRegister", 
                          "my_module_id", 
                          "MyClass", 
                          "OnAfterUserSimpleRegisterHandler");
?>

Example



<?
// file /bitrix/modules/my_module_id/include.php
class MyClass
{
    // create handler "OnAfterUserSimpleRegister"
    function OnAfterUserSimpleRegisterHandler(&$fields)
    {
        // if the registration succeeds...
        if($fields["USER_ID"]>0)
        {
            // set the registration confirmation message
            $fields["RESULT_MESSAGE"]["MESSAGE"] = 
            "Registration successful."
            "Your login: ".$fields["LOGIN"];
        }
    }
}
?>