Documentation

OnBeforeUserUpdate

bool handler function(
   array &arParams 
);
The event is called in the method CUser::Update before the user parameters are changed. It can be used to cancel or re-define specific fields.

Parameters

ParameterDescription
arParams Array of fields for modified user.

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.

Returned value

To cancel or terminate execution of the method CUser::Update, an exception must be created in the handler function via the method $APPLICATION->ThrowException() and return false.

See Also

Example of handler function:

<?
// file /bitrix/php_interface/init.php
// register the handler
AddEventHandler("main", "OnBeforeUserUpdate", Array("MyClass", "OnBeforeUserUpdateHandler"));
class MyClass { // create the handler function "OnBeforeUserUpdate" public static function OnBeforeUserUpdateHandler(&$arFields) { if(is_set($arFields, "LAST_NAME") && strlen($arFields["LAST_NAME"])<=0) { global $APPLICATION; $APPLICATION->throwException("Please, enter the last name. (ID:".$arFields["ID"].")"); return false; } } } ?>


© «Bitrix24», 2001-2024