handler function(
 array &arFields
The event OnAfterUserAdd fires after the new user is added via the method CUser::Add.


arFields Array of fields of the new user. Additionally, the array element with the index "RESULT" contains the result (returned value) of the method CUser::Add and in case of an error, the element with the index "RESULT_MESSAGE" will contain error description.

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.

See Also

Example of handler function:

// file /bitrix/php_interface/init.php
// register the handler
AddEventHandler("main", "OnAfterUserAdd", Array("MyClass", "OnAfterUserAddHandler"));
class MyClass { // cre ate event handler "OnAfterUserAdd" function OnAfterUserAddHandler(&$arFields) { if($arFields["ID"]>0) AddMessage2Log("Record with ID ".$arFields["ID"]." is added."); else AddMessage2Log("Fail to add the record (".$arFields["RESULT_MESSAGE"].")."); } } ?>

© «Bitrix24», 2001-2022