bool event_handler( array &arFields, );
The OnBeforeUserSimpleRegister event fires before a attempt of user simplified registration performed by CUser::SimpleRegister. This can be used to cancel the registration process or redefine fields.
Parameter | Description |
---|---|
arFields | 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 define add a LOGIN field (sensible user name - by default, the logis is set to user<new user ID>" after the registration) .
To cancel the user registration and terminate the CUser::SimpleRegister method, raise an exception from within the handler using the method
<? // file /bitrix/php_interface/init.php AddEventHandler( "main", "OnBeforeUserSimpleRegister", Array("MyClass", "OnBeforeUserSimpleRegisterHandler"), 100, $_SERVER["DOCUMENT_ROOT"]."/bitrix/php_interface/scripts/onbeforeusersimplereg.php" ); ?> <? // file /bitrix/php_interface/scripts/onbeforeusersimplereg.php class MyClass { // create handler "OnBeforeUserSimpleRegister" function OnBeforeUserSimpleRegisterHandler(&$arFields) { if (strpos($arFields["EMAIL"], "@mysite.com")===false) { global $APPLICATION; $APPLICATION->ThrowException("The registration is only possible " "for e-mail addresses of the domain mysite.com"); return false; } } } ?>
© 2001-2005 Bitrix | Bitrix Site Manager - Content Management & Portal Solutions |