handler function(
 array &arFields,
The event OnAfterUserSimpleRegister fires after a attempt of user simplified registration via the method CUser::SimpleRegister.


arFields Array of new user registration fields:
  • USER_ID - contains a new user ID if the registration succeeds.
  • RESULT_MESSAGE - array with text, describing user registration result. (can be passed to ShowMessage to show a message);
  • PASSWORD - password;
  • CONFIRM_PASSWORD - password confirmation;
  • CHECKWORD - new checkword for password change;
  • EMAIL - user e-mail;
  • ACTIVE - active state flag [Y|N];
  • SITE_ID - default site ID 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, it allows to change RESULT_MESSAGE, which leads to upd ated message, returned by the function CUser::SimpleRegister.

See Also:

Example of handler function registration:

// register the event handler "OnAfterUserSimpleRegister"
RegisterModuleDependences("main", "OnAfterUserSimpleRegister", "my_module_id", "MyClass", "OnAfterUserSimpleRegisterHandler");

Example of handler function:

// file /bitrix/modules/my_module_id/include.php
class MyClass
    // create event handler "OnAfterUserSimpleRegister"
   public static function OnAfterUserSimpleRegisterHandler(&$fields)
        // on successful registration
            // set the successful registration message
            $fields["RESULT_MESSAGE"]["MESSAGE"] = "You have successfully registered at the website. Your login - ".$fields["LOGIN"];

© «Bitrix24», 2001-2024