Bitrix Site Manager

OnAfterUserAdd event

event_handler(
 array &arFields
);
The OnAfterUserAdd event is fired upon an attempt to add a new user by calling CUser::Add.

Parameters

ParameterDescription
arFields An array of fields describing the user whose information is to be updated. Additionally, the RESULT field contains the return value of CUser::Add. If the latter failed, the RESULT_MESSAGE field will contain the error description.

Note
All parameters passed to this handler function and the arParams array are references to original variables. Therefore, all changes to parameters made within the handler affect values of the original variables.

See Also

  • OnBeforeUserAdd event
  • CUser::Add
  • Event handlers

    Example

    
    <?
    // file /bitrix/php_interface/init.php
    // register handler
    AddEventHandler("main", "OnAfterUserAdd", Array("MyClass", "OnAfterUserAddHandler"));
    
    class MyClass
    {
        // create the "OnAfterUserAdd" event handler
        function OnAfterUserAddHandler(&$arFields)
        {
            if($arFields["ID"]>0)
                AddMessage2Log("Redord with ID=".$arFields["ID"]." has been added.");
            else
                AddMessage2Log("Error adding record (".$arFields["RESULT_MESSAGE"].").");
        }
    }
    ?>