handler function(
 array &arFields
The event OnAfterUserUpdate fires after the attempt to change user properties by calling the method CUser::Update.


arFields Array of fields for the updated user data. Additionally, the array element with index RESULT contains the result (returned value) of the method CUser::Update and, in case of an error, the element with the index RESULT_MESSAGE contains error description.

If the $arFields["RESULT"] changes to false, the $USER->LAST_ERROR must be specified.

Note All parameters of this handler are the links to initial variables. That is why these parameters cannot be changed: the changes are not saved. Only RESULT_MESSAGE can be changed, which will lead to an updated message, returned by the function CUser::Register. If user registration fields must be updated prior to saving, use the event OnBeforeUserRegister

See Also

Example of handler function:

// file /bitrix/php_interface/init.php
// register the handler
AddEventHandler("main", "OnAfterUserUpdate", Array("MyClass", "OnAfterUserUpdateHandler"));
class MyClass { // create the event handler "OnAfterUserUpdate" public static function OnAfterUserUpdateHandler(&$arFields) { if($arFields["RESULT"]) AddMessage2Log("Record with ID ".$arFields["ID"]." is updated."); else AddMessage2Log("Fail to update the record".$arFields["ID"]." (".$arFields["RESULT_MESSAGE"].")."); } } ?>

© «Bitrix24», 2001-2023