Documentation

OnBeforeBlogDelete

bool
handler function(
 int   ID
);

The event is called in the CBlog::Delete method before deleting the blog and can be used to cancel the deletion.

Function paraemters

ParameterDescription
ID Deleted blog ID.

Returned value

To cancel the deleting and to terminate execution of the CBlog::Delete method, you must create an exception in the handler function by the $APPLICATION->ThrowException() method and return false.

See Also

Example

<?
// /bitrix/php_interface/init.php file
// register the handler
AddEventHandler("blog",
                "OnBeforeBlogDelete", 
                Array("MyClass", "OnBeforeBlogDeleteHandler"));


class MyClass
{
    // create the event handler "OnBeforeBlogDelete"
    public static function OnBeforeBlogDeleteHandler($ID)
    {
        if(IntVal($ID) == 1)
        {
            global $APPLICATION;
            $APPLICATION->throwException("First blog cannot be deleted");
            return false;
        }
    }
}
?>


© «Bitrix24», 2001-2024
Up