Documentation

OnUserDelete

handler function(
 int user_id
)
The event "OnUserDelete" fires when user is deleted. Usually, the purpose of this event handler is to clean the database of records associated with deleted user.

Parameters

ParameterDescription
user_id Deleted user ID.

See Also

Example of handler function:

<?
// file /bitrix/modules/my_module_id/include.php
class MyClass
{
    // create the event handler "OnUserDelete"
    function OnUserDeleteHandler($user_id)
    {
        // delete associated records 
       global $DB;
        $strSql = "DELETE FR OM my_table WH ERE USER_ID=".intval($user_id);
        $rs = $DB->Query($strSql, false, "FILE: ".__FILE__."
LINE: ".__LINE__); } } ?>

Example of handler function registration:

<?
// register the event handler "OnUserDelete"
RegisterModuleDependences("main", "OnUserDelete", 
        "my_module_id", "MyClass", "OnUserDeleteHandler");
?>


© «Bitrix24», 2001-2022
Up