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
Parameter | Description |
---|---|
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 theSee Also
- "OnBlogDelete" event
- CBlog::Delete
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