Documentation

Events List

The list of main module events is provided below. To register a handler, specify "main" as the module identifier.

  • Events to execute each page
  • Events to handle users and authorization
  • Events to handle user groups
  • Events to handle files and access permissions
  • Events to handle mail event templates
  • Events to handle sites
  • Events to handle languages
  • Events to handle Control Panel
  • Events to handle ratings
  • Events to handle text parsing
  • Events to update the system
  • Events to install modules
  • Events to handle user fields
  • Other events
  • See Also

    Events called during page execution

    Event is Called Method Available from version
    OnPageStart at the start of the executable section of the site prologue, after all libraries are included and agents are processed.
    OnBeforeProlog in the executable section of a site prologue (after [link= 6659348]OnPageStart[/link]).
    OnProlog at the beginning of processing the visual aspect of the site prologue. CAllMain::PrologActions
    OnEpilog at the end of site epilog visual part.
    OnAfterEpilog at the end of the executable section of a site epilogue (after [link=90118]OnEpilog[/link]).
    OnBeforeEndBufferContent before showing buffered content. CAllMain::EndBufferContent
    OnBeforeRestartBuffer before content buffer reset CAllMain::RestartBuffer
    OnEndBufferContent at the end of buffer content reset. CAllMain::EndBufferContent

    Events to handle users and authorization

    Event is Called Method Available from version
    OnBeforeUserRegister before new user registration attempt CUser::Register
    OnAfterUserRegister after new user registration attempt CUser::Register
    OnBeforeUserSimpleRegister before new user simplified registration attempt CUser::SimpleRegister
    OnAfterUserSimpleRegister after new user simplified registration attempt CUser::SimpleRegister
    OnBeforeUserLogin before user authorization attempt CUser::Login
    OnUserLoginExternal before user authorization attempt, designed to check external authorization. CUser::Login
    OnAfterUserLogin after user authorization attempt [link= 6658397]CUser::Login[/link]
    OnBeforeUserLoginByHash before user authorization attempt CUser::LoginByHash
    OnAfterUserLoginByHash after user authorization attempt CUser::LoginByHash
    OnAfterUserAuthorize after user authorization CAllUser::Authorize
    OnBeforeUserLogout before user logout CUser::Logout
    OnAfterUserLogout after user logout CUser::Logout
    OnBeforeUserAdd before adding new user. CAllUser::CheckFields
    OnAfterUserAdd after adding new user. CUser::Add
    OnBeforeUserUpdate before user parameter update. CAllUser::CheckFields
    OnAfterUserUpdate after user parameter update. CAllUser::Update
    OnBeforeUserDelete before deleting a user. CAllUser::Delete
    OnUserDelete during user deletion. CAllUser::Delete
    OnExternalAuthList to getting the external authorization list. CAllUser::GetExternalAuthList
    OnBeforeUserChangePassword before user password change CUser::ChangePassword
    OnBeforeUserSendPassword before sending password to user CUser::SendPassword
    OnUserLogin during login attempt CUser::Authorize
    OnUserLogout after user logout session is completed CUser::Logout
    OnSendUserInfo when data is sent to user CUser::SendUserInfo
    OnAuthProvidersBuildList when authorization providers are created CAccess::__construct

    See Also

    Events to handle user groups

    Event is Called Method Available from version
    OnBeforeGroupDelete before deleting user group CAllGroup::Delete
    OnGroupDelete when user group is deleted CAllGroup::Delete
    OnAfterGroupAdd after new user group is added CAdminTabControl::Begin
    OnAfterGroupUpdate after user group is modified [link=89856]CGroup::Update[/link]
    OnBeforeGroupAdd before adding user groups [link=89851]CGroup::Add[/link]
    OnBeforeGroupUpdate before updating user group [link=89856]CGroup::Update[/link]

    Events to hand files and access permissions

    Event is Called Method Available from version
    OnBeforeChangeFile when file is modified immediately before saving. CAllMain::SaveFileContent
    OnChangePermissions when access permissions are modified for file or folder. CAllMain::RemoveFileAccessPermission
    OnFileDelete when deleting file from the tableb_file. CFile::Delete
    OnAfterResizeImage after image size is modified CFile::ResizeImageGet
    OnBeforeChangeFile prior modifying the file CMain::SaveFileContent
    OnBeforeResizeImage prior to modifying image size CFile::ResizeImageGet
    OnFileCopy when copying the file CFile::CopyFile
    OnFileSave when saving file

    Example: when saved, original image resolution is reduced to 1920*1920

    AddEventHandler("main",'OnFileSave','OnFileSave');
    function OnFileSave(&$arFile, $fileName, $module)
    {
       $arNewFile = CIBlock::ResizePicture($arFile, array("WIDTH" => 1920, "HEIGHT" => 1920, "METHOD" => "resample"));
       if(is_array($arNewFile))
          $arFile = $arNewFile;
       else
          $APPLICATION->throwException("Image scale Image scaling error in the property\"Files\":".$arNewFile);
    
    }
    CFile::SaveFile
    OnGetFileSRC when getting image address CFile::GetFileSRC
    OnMakeFileArray when creating an array, describing the file CFile::MakeFileArray
    OnSearchGetFileContent when indexing by search module CUserTypeFile::__GetFileContent
    OnTaskOperationsChanged when access permission level CTask::SetOperations

    Events to handle mail message templates

    Event is Called Method Available from version
    OnBeforeEventMessageDelete before deleting mail template. CAllEventMessage::Delete
    OnEventMessageDelete during deleting mail template [link=89827]CEventMessage::Delete[/link]
    OnBeforeEventAdd before adding mail template CEvent::Send
    OnBeforeEventSend before sending mail event CEvent::HandleEvent

    Events to handle sites

    Event is Called Method Available from version
    OnBeforeSiteDelete prior to site deleting. CAllSite::Delete
    OnSiteDelete when site is deleted. CAllSite::Delete
    OnBeforeSiteAdd before adding site to the system CSite::CheckFields
    OnBeforeSiteUpdate before site update CSite::CheckFields

    Events to handle languages

    Event is Called Method Available from version
    OnBeforeLanguageDelete prior to deleting the language. CAllLanguage::Delete
    OnLanguageDelete when language is deleted CAllLanguage::Delete
    OnBeforeLangDelete before deleting language from the system CSite::Delete
    OnLangDelete when deleting language from the system CSite::Delete

    Events to handle control panel and administrative section

    Event is Called Method Available from version
    OnPanelCreate when collecting data for building the control panel in the public section of site. CTopPanel::InitPanelIcons
    OnAdminContextMenuShow when showing buttons menu in the administrative section. CAdminContextMenu::Show
    OnAdminListDisplay when showing list of elements in the administrative section. CAdminList::Display
    OnAdminTabControlBegin when showing edit form in the administrative section interface. CAdminTabControl::Begin
    OnAfterSetOption_ after modifying module settings COption::SetOptionString
    OnBuildGlobalMenu when building menu in the administrative section CAdminMenu::Init

    See Also

    Events to handle ratings

    Event is Called Method Available from version
    OnAddRatingVote when adding a vote for content. CRatings::Add
    OnAfterCheckAllowVote when checking access permissions for voting. Prior to adding a vote, array type array('RESULT' => false, 'ERROR_TYPE' => 'error type', 'ERROR_MSG' => 'error description') must be returned - vote will not be accounted for. If true is returned, the vote will be accounted. CRatingRule::Add
    OnCancelRatingVote when cancelling previously cast vote for content. CRatings::Update
    OnAfterUpdateRatingRule when updating the rating processing rule CRatingRule::Update
    OnBeforeDeleteRating prior to deleting of rating CRatings::Delete
    OnBeforeDeleteRatingRule prior to deleting of rating processing rule CRatingRule::Delete
    OnGetRatingContentOwner when adding a vote to determine the content author ID CRatings::AddRatingVote
    OnGetRatingRuleConfigs when generating page to add (edit) processing rules to get rules settings CRatingRule::GetRatingRuleConfigs
    OnGetRatingRuleObjects when calling rating processing rules CRatingRule::GetRatingRuleObjects
    OnGetRatingsConfigs when generating page to add (edit) processing rules to get vote objects. These rules can be applied to these voting objects CRatings::GetRatingConfigs
    OnGetRatingsObjects when generating page to add (edit) ratings to get rating component settings CRatings::GetRatingObjects

    Events to handle text parsing

    Event is Called Method Available from version
    TextParserAfter after parsing CTextParser::convertText
    TextParserAfterTags after parsing of tags CTextParser::convertText
    TextParserBefore before parsing CTextParser::convertText
    TextParserBeforePattern before parsing CTextParser::convertText
    TextParserBeforeTags before parsing of tags CTextParser::convertText
    TextParserVideoConvert when parsing video tag CTextParser::convert_video

    Events to handle system updates

    Event is Called Method Available from version
    OnUpdatesInstalled after updates are installed. Has a single parameter: array type:
    Array (
       "successModules" => $arSuccessModules,
       "loadModules" => $arLoadModules,
       "errorModules" => $arErrorModules,
       "modulesUpdates" => $arModulesUpdates
    CUpdateOutput::ShowBlockInfo
    OnModuleUpdate after the module update CUpdateClientPartner::UpdateStepModules

    Events to install modules

    Event is Called Method Available from version
    OnAfterRegisterModule after module registration RegisterModule
    OnAfterUnRegisterModule after module is uninstalled UnRegisterModule

    Events to handle user fields

    Event is Called MethodAvailable from version
    OnUserTypeBuildList when building list of user fields CUserTypeManager::GetUserType
    OnUserTypeRightsCheck when checking access permissions for user fields GetRights
    OnAfterFetch after a selection fetching
    onAfterUserTypeUpdate after user field. Arguments:
    • $arFields - array of fields after update
    • $ID - field ID.
    CUserTypeEntity
    OnAfterUserTypeDelete after user field is deleted. Arguments:
    • $arFields - array of fields for deleted element
    • $ID - field ID.
    CUserTypeEntity

    Other events

    Event is Called Method Available from version
    OnAutoSaveRestore when resorting autosaved data CAutoSave::_Restore
    OnBeforeLocalRedirect before redirect LocalRedirect
    OnLocalRedirect when redirect LocalRedirect
    OnCheckListGet when sending a checklist CCheckList::__construct
    [link=6659342]onAfterAjaxResponse[/link] after Ajax request processing to the component in the Ajax-mode ExecuteEvents
    OnAfterShortUriAdd after adding a short URL CBXShortUri::Add
    OnBeforeShortUriDelete before deleting a short URL CBXAllShortUri::Delete


    © «Bitrix24», 2001-2022
    Up