OnAfterUserRegister
handler function( array &arFields );The OnAfterUserRegister event fires after a new user login attempt by the CUser::Register method.
Parameters
Parameter | Description |
---|---|
arFields | Array of new user registration fields:
|
NoteAll parameters passed to this handler function are references to original variables. That is why its impossible to change these parameters: changes will not be saved. Actually, only RESULT_MESSAGE can be changed, which will lead to the change of the message, returned by the CUser::Register method. If user registration fields must be modified before saving, use the OnBeforeUserRegister event.
See Also:
Example of handler function:
<?
// file /bitrix/modules/my_module_id/include.php
class MyClass
{
// create the event handler "OnAfterUserRegister"
public static function OnAfterUserRegisterHandler(&$arFields)
{
// if auth succeeds...
if($arFields["USER_ID"]>0)
{
// if the current site is r1...
if(SITE_ID=="r1")
{
// set the message which confirms the registration within site r1
$arFields["RESULT_MESSAGE"]["MESSAGE"] = "You have successfully registered with site \"My site 1" \"My favourite site 1\"";
}
elseif(SITE_ID=="r2")
{
// set the message which confirms the registration within site r2
$arFields["RESULT_MESSAGE"]["MESSAGE"] = "You have successfully registered \"My favourite site 2\"";
}
}
return $arFields;
}
}
?>
Example of handler function registration:
<?
// register the event handler "OnAfterUserRegister"
RegisterModuleDependences("main", "OnAfterUserRegister", "my_module_id", "MyClass", "OnAfterUserRegisterHandler");
?>
© «Bitrix24», 2001-2023