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;
}
}