bool event_handler( array &arArgs );
The OnBeforeUserRegister event fires before an attempt of a new user registration by calling the method CUser::Register. This can be used to cancel the registration process or redefine fields.
Parameter | Description |
---|---|
arArgs | Array of new user registration fields:
|
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. This allows to add additional user
registration fields or a NEW_USER e-mail event fields to the array arArgs.
To cancel the user registration and terminate the CUser::Register method, raise an exception from within the handler using the method
<? // file /bitrix/modules/my_module_id/include.php class MyClass { // create handler "OnBeforeUserRegister" function OnBeforeUserRegisterHandler(&$arFields) { // if a user came under the adv campaign #34... if ($_SESSION["SESS_LAST_ADV_ID"]==34) { // add him to group #3 $arFields["GROUP_ID"][] = 3; // add admin comment if (intval($_SESSION["SESS_ADV_ID"])>0) $arFields["ADMIN_NOTES"] = "Adv. campaign #34 - direct hit"; else $arFields["ADMIN_NOTES"] = "Adv. campaign #34 - return"; $arFields["SITE_ID"] = "ru"; } } } ?>
<? // register handler "OnBeforeUserRegister" RegisterModuleDependences("main", "OnBeforeUserRegister", "my_module_id", "MyClass", "OnBeforeUserRegisterHandler"); ?>
© 2001-2005 Bitrix | Bitrix Site Manager - Content Management & Portal Solutions |