bool event_handler( array &arParams );The OnBeforeUserUpdate event is fired from the CUser::Update method before a user parameter changes, which can be used to cancel update or modify the user record fields.
Parameter | Description |
---|---|
arParams | An array of fields describing the user whose information is to be updated. |
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.
To cancel update and terminate the CUser::Update
method, raise an exception from within the handler using the method
<? // file /bitrix/php_interface/init.php // register handler AddEventHandler("main", "OnBeforeUserUpdate", Array("MyClass", "OnBeforeUserUpdateHandler")); class MyClass { // create the "OnBeforeUserUpdate" event handler function OnBeforeUserUpdateHandler(&$arFields) { if(is_set($arFields, "LAST_NAME") && strlen($arFields["LAST_NAME"])<=0) { global $APPLICATION; $APPLICATION->throwException("Please type in the last name. (ID:".$arFields["ID"].")"); return false; } } } ?>
© 2001-2005 Bitrix | Bitrix Site Manager - Content Management & Portal Solutions |