I want to know where I have to put below custom event handler code in bitrix24(self-hosted system) without changing any core file.
AddEventHandler('socialnetwork', 'OnBeforeSocNetGroupAdd', 'TestHandler');
function TestHandler(&$arFields) {
$arFields['DESCRIPTION'] .= ' It is forbidden to use foul language!';
if ($GLOBALS['USER']->GetID() == 2) {
$GLOBALS['APPLICATION']->throwException('You cannot create groups.');
return false;
}
}
If not custom module, you can put your code in two places:
/bitrix/php_interface/init.php
(if there is no init.php file, create it)or
local
folder in the root of the project, you can create file init.php
in /local/php_interface/init.php