These hooks are only triggered from the login page for the admin console.
Core::LoginFailed
Called from within the login page, after a user failed to enter valid credentials.
Related Event: Core::LoginFailed
Parameters: This hook receives it's arguments in the form of a single associative array. The keys for this associative array are below.
user - (string)
The username provided in the login form.
Core::LoginPre
Called immediately prior to a login to the admin console.
Parameters: This hook receives it's arguments in the form of a single associative array. The keys for this associative array are below.
user - (string)
The username provided in the login form.
Core::LoginPost
Called immediately after a successful login to the admin console.
Related Event: Core::LoginPost
Parameters: This hook receives it's arguments in the form of a single associative array. The keys for this associative array are below.
user - (string)
The username provided in the login form.
Core::LogoutPre
Called immediately prior to a logout from the admin core.
Parameters: This hook receives it's arguments in the form of a single associative array. The keys for this associative array are below.
uid - (int)
The id of the admin user who is logging out.
username - (string)
The username provided in the lost password form.
Core::LogoutPost
Called immediately after a logout from the admin core.
Related Event: Core::LogoutPost
Parameters: This hook receives it's arguments in the form of a single associative array. The keys for this associative array are below.
uid - (int)
The id of the admin user who is logging out.
username - (string)
The username provided in the lost password form.
Core::LostPassword
Called from within the login page, when a user has submitted the lost password form, but prior to the recover email being sent.
Parameters: This hook receives it's arguments in the form of a single associative array. The keys for this associative array are below.
username - (string)
The username provided in the lost password form.
Core::LostPasswordReset
Called after a user has successfully completed the lost password functionality.
Parameters: This hook receives it's arguments in the form of a single associative array. The keys for this associative array are below.
uid - (int)
The id of the admin user whos password has been reset.
username - (string)
The username provided in the lost password form.
ip - (string)
The IP address of the user completing the requst.
Admin Requests
Hooks triggred by the CMSMS Core for admin requests.
admin_add_footertext
Called in admin requests to allow loaded modules to add text to the body of the rendered output, directly before the closing
tag.
Parameters: None
Returns:(string) - A single string of html content to add to the bottom of the rendered page.
admin_add_headtext
Triggered in admin requests to allow postprocessing html output.
Parameters: This hook receives it's arguments in the form of a single associative array. The keys for this associative array are below.
content - (String reference) - modifiable
The HTML content that will be rendered.
Returns:(string) - A single string of html content to add to the bottom of the rendered page.
admin_add_headtext
Called in admin module action requests to allow loaded modules to add HTML content to the head of the rendered output.
Parameters: None
Returns:(string) - A single string of html content to add to the bottom of the rendered page.
Admin Users and Groups
Hooks related to the management of admin users and groups.
These hooks are only triggered from the admin console when maniuplating admin user accounts or groups.
Core::AddUserPre
Called immiediately before a new admin user object is saved to the database.
Related Event: Core::AddUserPre
Parameters: This hook receives it's arguments in the form of a single associative array. The keys for this associative array are below.
user - (User reference) - modifiable
A reference to the user object that will be saved.
Core::AddUserPost
Called immiediately after a new admin user object is saved to the database.
Related Event: Core::AddUserPost
Parameters: This hook receives it's arguments in the form of a single associative array. The keys for this associative array are below.
user - (User reference) - modifiable
A reference to the user object that has been saved.
Core::EditUserPre
Called immiediately before an existing admin user object is saved to the database.
Related Event: Core::EditUserPre
Parameters: This hook receives it's arguments in the form of a single associative array. The keys for this associative array are below.
user - (User reference) - modifiable
A reference to the user object that will be saved.
Core::EditUserPost
Called immiediately after an existing admin user object is saved to the database.
Related Event: Core::EditUserPost
Parameters: This hook receives it's arguments in the form of a single associative array. The keys for this associative array are below.
user - (User reference) - modifiable
A reference to the user object that has been saved.
Core::DeleteUserPre
Called immiediately before an existing admin user object is removed from the database.
Related Event: Core::DeleteUserPre
Parameters: This hook receives it's arguments in the form of a single associative array. The keys for this associative array are below.
user - (User reference) - modifiable
A reference to the user object that will be removed.
Core::DeleteUserPost
Called immiediately after an existing admin user object is removed the database.
Related Event: Core::DeleteUserPost
Parameters: This hook receives it's arguments in the form of a single associative array. The keys for this associative array are below.
user - (User reference) - modifiable
A reference to the user object that has been removed.
Core::AddGroupPre
Called immiediately before a new admin group object is added to the database.
Related Event: Core::AddGroupPre
Parameters: This hook receives it's arguments in the form of a single associative array. The keys for this associative array are below.
group - (Group reference) - modifiable
A reference to the group object that will be saved.
Core::AddGroupPost
Called immiediately after a new admin group object is added to the database.
Related Event: Core::AddGroupPost
Parameters: This hook receives it's arguments in the form of a single associative array. The keys for this associative array are below.
group - (Group reference) - modifiable
A reference to the group object that has been saved.
Core::EditGroupPre
Called immiediately before an existing admin group object is saved to the database.
Related Event: Core::EditGroupPre
Parameters: This hook receives it's arguments in the form of a single associative array. The keys for this associative array are below.
group - (Group reference) - modifiable
A reference to the group object that will be saved.
Core::EditGroupPost
Called immiediately after an existing admin group object is saved to the database.
Related Event: Core::EditGroupPost
Parameters: This hook receives it's arguments in the form of a single associative array. The keys for this associative array are below.
group - (Group reference) - modifiable
A reference to the group object that has been saved.
Core::DeleteGroupPre
Called immiediately before an existing admin group object is removed from the database.
Related Event: Core::DeleteGroupPre
Parameters: This hook receives it's arguments in the form of a single associative array. The keys for this associative array are below.
group - (Group reference) - modifiable
A reference to the group object that will be removed.
Core::DeleteGroupPost
Called immiediately after an existing admin group object is removed the database.
Related Event: Core::DeleteGroupPost
Parameters: This hook receives it's arguments in the form of a single associative array. The keys for this associative array are below.
group - (Group reference) - modifiable
A reference to the group object that has been removed.
Core::ChangeGroupAssignPre
Called immidiately before group assignments are saved to the database.
Related Event: Core::ChangeGroupAssignPre
Parameters: This hook receives it's arguments in the form of a single associative array. The keys for this associative array are below.
group - (Group reference) - modifiable
A reference to the related group object. Note the group is not saved to the database after this event.
users - (User array)
An array of the users that are currently in the specified group.
Core::ChangeGroupAssignPost
Called immediately after group assignments are saved to the database.
Related Event: Core::ChangeGroupAssignPost
Parameters: This hook receives it's arguments in the form of a single associative array. The keys for this associative array are below.
group - (Group reference) - modifiable
A reference to the related group object. Note the group is not saved to the database after this event.
users - (User array)
An array of the users that are now in the specified group.
localizeperm
Called when building the permission list to allow localizing the name of a permission.
Parameters:
(string)
A permission name to be localized.
Returns:(string) - A localized permission name.
Example:
// place this in a module's InitializeAdmin method.
\CMSMS\HookManager::add_hook('localizeperm',function($in){ if($in=='my perm')return$this->Lang('perm_'.$in); });
getperminfo
Called when building the permission list to allow retrieving a localized information string for a permission.
Parameters: This hook receives it's arguments in the form of a single associative array. The keys for this associative array are below.
(string)
A permission name to be localized.
Returns:(string) - A localized information string.
AdminSearch Module
Hooks triggred by the AdminSearch module.
Cms Job Manager Module
Hooks triggred by the core Job Manager.
CmsJobManager::OnJobFailed
A hook triggered when an asynchronous job has failed.
Parameters: This hook receives it's arguments in the form of a single associative array. The keys for this associative array are below.
job - (CMSMS\Async\Job)
The job that has failed.
Compiling and Rendering
Hooks used for generating HTML code, typically from smarty or other templates.
These hooks typically only occur on frontend requests.
Core::StylesheetPreCompile
Triggered before a stylesheet is compiled.
Related Event: Core::StylesheetPreCompile
Parameters: This hook receives it's arguments in the form of a single associative array. The keys for this associative array are below.
stylesheet - (string) - modifiable
The contents of the template before compiling.
Core::ContentPreCompile
Triggered before a content block is compiled.
Related Event: Core::ContentPreCompile
Parameters: This hook receives it's arguments in the form of a single associative array. The keys for this associative array are below.
content - (string) - modifiable
The contents of the content block before compiling.
Core::TemplatePreCompile
Triggered before any other template is compiled.
Related Event: Core::TemplatePreCompile
Parameters: This hook receives it's arguments in the form of a single associative array. The keys for this associative array are below.
template - (string) - modifiable
The contents of the template before compiling.
type - (string)
The type of template being compiled.
Core::SmartyPreCompile
Triggered before any template is compiled, but after the above compilation events.
Related Event: Core::SmartyPreCompile
Parameters: This hook receives it's arguments in the form of a single associative array. The keys for this associative array are below.
template - (string) - modifiable
The contents of the template before compiling.
Core::StylesheetPostCompile
Triggered after a stylesheet is compiled.
Related Event: Core::StylesheetPostCompile
Parameters: This hook receives it's arguments in the form of a single associative array. The keys for this associative array are below.
stylesheet - (string) - modifiable
The contents of the template after compiling.
Core::PreDetermineCSS
Triggered early within the {cms_render_css} plugin this hoook allows modifying the list of scripts that are processed.
Parameters:
(string[])
An array of strings representing the queued CSS files. This hook can be used to add, edit or delete the list of queued files.
Returns:(string[]|null) - A modified array of queued CSS files. May also return null
Triggered early within the {cms_render_scripts} plugin this hoook allows modifying the list of scripts that are processed.
Parameters:
(string[])
An array of strings representing the queued script files. This hook can be used to add, edit or delete the list of queued files.
Returns:(string[]|null) - A modified array of queued script files. May also return null
Core::PostProcessCSS
Triggered after stylesheets are rendered via the {cms_render_css} plugin.
Parameters:
(string)
The compiled and concatenated CSS.
Returns:(string) - The post-processed CSS.
Example:
cmsms()->app->get_hook_manager()->add_hook('Core::PostProcessCSS',function(string $css){ return$css."\nI did this\n"; });
Core::PostProcessScripts
Triggered after scripts are rendered via the {cms_render_scripts} plugin.
Parameters:
(string)
The compiled and concatenated scripts.
Returns:(string) - The post-processed scripts.
Example:
cmsms()->app->get_hook_manager()->add_hook('Core::PostProcessScripts',function(string $css){ return$css."\nI did this\n"; });
Core::ProcessCSSFile
Triggeredd by the {cms_css_render} plugin on each queued CSS file to allow processing of individual files before concatenation.
Parameters: This hook receives it's arguments in the form of a single associative array. The keys for this associative array are below.
content - (string) - modifiable
The contents of the CSS file.
file - (string) - modifiable
The provided CSS file path and name.
Core::ProcessScript
Triggered by the {cms_render_scripts} plugin on each queued script file to allow processing of individual files before concatenation.
Parameters: This hook receives it's arguments in the form of a single associative array. The keys for this associative array are below.
content - (string) - modifiable
The contents of the script file.
file - (string) - modifiable
The provided script file path and name.
Core::ContentPostCompile
Triggered after a content block is compiled.
Related Event: Core::ContentPostCompile
Parameters: This hook receives it's arguments in the form of a single associative array. The keys for this associative array are below.
content - (string) - modifiable
The contents of the content block after compiling.
Core::TemplatePostCompile
Triggered after any other template is compiled.
Related Event: Core::TemplatePostCompile
Parameters: This hook receives it's arguments in the form of a single associative array. The keys for this associative array are below.
template - (string) - modifiable
The contents of the template after compiling.
type - (string)
The type of template being compiled.
Core::SmartyPostCompile
Triggered after any template is compiled, and after the above compilation events.
Related Event: Core::SmartyPostCompile
Parameters: This hook receives it's arguments in the form of a single associative array. The keys for this associative array are below.
template - (string) - modifiable
The contents of the template after compiling.
metadata_prerender
Triggered by the {metadata} plugin, before any output is generated.
Parameters: This hook receives it's arguments in the form of a single associative array. The keys for this associative array are below.
content_id - (int)
The id of the content page being rendered.
showbase - (boolean reference)
Whether or not to include the base href tag.
html - (string reference) - modifiable
The content to render.
metadata_postrender
Triggered by the {ldelim}metadata} plugin, after output is generated.
Parameters: This hook receives it's arguments in the form of a single associative array. The keys for this associative array are below.
content_id - (int)
The id of the content page being rendered.
html - (string reference) - modifiable
The content to render.
Core::ContentPreRender
Called before page rendering begins.
Related Event: Core::ContentPreRender
Parameters: This hook receives it's arguments in the form of a single associative array. The keys for this associative array are below.
content - (ContentBase reference) - modifiable
The content object being referenced.
Core::ContentPostRender
Called after page rendering is complete.
Related Event: Core::ContentPostRender
Parameters: This hook receives it's arguments in the form of a single associative array. The keys for this associative array are below.
content - (string) - modifiable
The HTML content to output.
Core::PageTopPreRender
Called before rendering (including compiling) of the top portion of the template. This hook is only called if the content processing mode config entry is greater than 0.
Parameters: This hook receives it's arguments in the form of a single associative array. The keys for this associative array are below.
content - (ContentBase reference) - modifiable
The content object being referenced.
html - (string reference) - modifiable
The html to be rendered
Core::PageTopPostRender
Called afteer rendering (including compiling) of the top portion of the template. This hook is only called if the content processing mode config entry is greater than 0.
Parameters: This hook receives it's arguments in the form of a single associative array. The keys for this associative array are below.
content - (ContentBase reference) - modifiable
The content object being referenced.
html - (string reference) - modifiable
The html to be rendered
Core::PageBodyPreRender
Called before rendering (including compiling) of the body portion of the template. This hook is only called if the content processing mode config entry is greater than 0.
Parameters: This hook receives it's arguments in the form of a single associative array. The keys for this associative array are below.
content - (ContentBase reference) - modifiable
The content object being referenced.
html - (string reference) - modifiable
The html to be rendered
Core::PageBodyPostRender
Called after rendering (including compiling) of the body portion of the template. This hook is only called if the content processing mode config entry is greater than 0.
Parameters: This hook receives it's arguments in the form of a single associative array. The keys for this associative array are below.
content - (ContentBase reference) - modifiable
The content object being referenced.
html - (string reference) - modifiable
The html to be rendered
Core::PageHeadPreRender
Called before rendering (including compiling) of the head portion of the template. This hook is only called if the content_processing_mode config entry is greater than 0.
Parameters: This hook receives it's arguments in the form of a single associative array. The keys for this associative array are below.
content - (ContentBase reference) - modifiable
The content object being referenced.
html - (string reference) - modifiable
The html to be rendered
Core::PageHeadPostRender
Called afteer rendering (including compiling) of the head portion of the template. This hook is only called if the content_processing_mode config entry is greater than 0.
Parameters: This hook receives it's arguments in the form of a single associative array. The keys for this associative array are below.
content - (ContentBase reference) - modifiable
The content object being referenced.
html - (string reference) - modifiable
The html to be rendered
Content
Core::ContentEditPre
Triggered before a content object is saved to the database. This event is sent for both new content objects, and existing content objects.
Related Event: Core::ContentEditPre
Parameters: This hook receives it's arguments in the form of a single associative array. The keys for this associative array are below.
content - (ContentObject) - modifiable
A reference to the content object about to be saved.
Core::ContentEditPost
Triggered after a content object is saved to the database. This event is sent for both new content objects, and existing content objects.
Related Event: Core::ContentEditPost
Parameters: This hook receives it's arguments in the form of a single associative array. The keys for this associative array are below.
content - (ContentObject) - modifiable
A reference to the content object that was just saved.
Example:
// place this in a module's InitializeAdmin method.
\CMSMS\HookManager::add_hook('Core::ContentEditPost',function($params){ $params['content'].='<!-- a hidden comment -->'; ));
Core::ContentDeletePre
Triggered before a content object is removed from the database.
Related Event: Core::ContentDeletePre
Parameters: This hook receives it's arguments in the form of a single associative array. The keys for this associative array are below.
content - (ContentObject) - modifiable
A reference to the content object about to be removed.
Core::ContentDeletePost
Triggered after a content object is removed from the database.
Related Event: Core::ContentDeletePre
Parameters: This hook receives it's arguments in the form of a single associative array. The keys for this associative array are below.
content - (ContentObject) - modifiable
A reference to the content object that has been removed.
File Manager Module
Hooks triggred by the File Manager.
FileManager::OnFileDeleted
Called immediately after a file is deleted from the filesystem.
Related Event: FileManager::OnFileDeleted
Parameters: This hook receives it's arguments in the form of a single associative array. The keys for this associative array are below.
file - (string)
The name of the file uploaded.
FileManager::OnFileUploaded
Called immediately after a file has been uploaded to the filesystem.
Related Event: FileManager::OnFileUploaded
Parameters: This hook receives it's arguments in the form of a single associative array. The keys for this associative array are below.
file - (string)
The complete path of the file uploaded.
thumb - (string)
If create thumbnails is enabled, and the uploaded file is an image, then this variable will contain the complete path to the generated thumbnail.
Localization
localizeperm
Called when building the permission list to allow localizing the name of a permission.
Parameters:
(string)
A permission name to be localized.
Returns:(string) - A localized permission name.
Example:
// place this in a module's InitializeAdmin method.
\CMSMS\HookManager::add_hook('localizeperm',function($in){ if($in=='my perm')return$this->Lang('perm_'.$in); });
getperminfo
Called when building the permission list to allow retrieving a localized information string for a permission.
Parameters: This hook receives it's arguments in the form of a single associative array. The keys for this associative array are below.
(string)
A permission name to be localized.
Returns:(string) - A localized information string.
Miscellaneous
Core::AfterClearCache
Triggered before CMSMS cache files are cleared.
Parameters: None
Core::BeforeClearCache
Triggered aftger CMSMS cache files are cleared.
Parameters: None
Core::InitDebugMode
If debug is enabled in the config.php this hook is called for every request.
Parameters: None
Core::InitDebugMode
If developer_mode is enabled in the config.php this hook is called for every request.
Parameters: None
clear_cached_files
Called immediately before clearing the admin cache. Note: use this hook with caution. Modules cannot delete the cache generated by or data managed by other modules or the core.
Parameters: This hook receives it's arguments in the form of a single associative array. The keys for this associative array are below.
older_than - (int)
the maximum age (in days) of entries/items to remove.
time - (int)
The minimum date of files to preserve.
Module Manager Module
Hooks triggred by the Module Manager.
ModuleManager::BeforeModuleExport
Called immediately before a module is exported to XML.
Parameters: This hook receives it's arguments in the form of a single associative array. The keys for this associative array are below.
module_name - (string)
The name of the module that is being exported.
version - (string)
The version string of the module that is being exported.
ModuleManager::AfterModuleExport
Called immediately after a module is exported to XML.
Parameters: This hook receives it's arguments in the form of a single associative array. The keys for this associative array are below.
module_name - (string)
The name of the module that is being exported.
version - (string)
The version string of the module that is being exported.
ModuleManager::BeforeModuleImport
Called immediately before a module is imported from an XML file..
Parameters: This hook receives it's arguments in the form of a single associative array. The keys for this associative array are below.
file - (string)
The name of the imported file.
ModuleManager::AfterModuleImport
Called immediately after a module is imported from an XML file..
Parameters: This hook receives it's arguments in the form of a single associative array. The keys for this associative array are below.
file - (string)
The name of the imported file.
Modules
Core::BeforeModuleActivated
Triggered immediately before a module is activated or deactivated..
Related Event: Core::ModuleInstalled
Parameters: This hook receives it's arguments in the form of a single associative array. The keys for this associative array are below.
name - (string)
The name of the installed module.
version - (boolean)
Whether the module as activated or deactivated.
Core::BeforeModuleActivated
Triggered immediately after a module is activated or deactivated..
Related Event: Core::ModuleInstalled
Parameters: This hook receives it's arguments in the form of a single associative array. The keys for this associative array are below.
name - (string)
The name of the installed module.
version - (boolean)
Whether the module as activated or deactivated.
Core::ModuleInstalled
Triggered after a module installation has completed.
Related Event: Core::ModuleInstalled
Parameters: This hook receives it's arguments in the form of a single associative array. The keys for this associative array are below.
name - (string)
The name of the installed module.
version - ((string))
The version of the installed module.
Core::ModuleLoaded
Triggered after a module has been loaded into memory
Parameters: This hook receives it's arguments in the form of a single associative array. The keys for this associative array are below.
name - (string)
The name of the installed module.
Core::ModuleUninstalled
Triggered after a module uninstall has completed.
Related Event: Core::ModuleUninstalled
Parameters: This hook receives it's arguments in the form of a single associative array. The keys for this associative array are below.
name - (string)
The name of the un-installed module.
Core::ModuleUpgraded
Triggered after a module upgrade has completed.
Related Event: Core::ModuleUpgraded
Parameters: This hook receives it's arguments in the form of a single associative array. The keys for this associative array are below.
name - (string)
The name of the installed module.
oldversion - (string)
oThe version of the installed module before the upgrade
newversion - (string)
The version of the installed module after the upgrade
module_action
Triggererd immediately before a module action is called. Along with the parameters specified below, handlers for this hook are passed all of the arguments and parameters that were passed in the smarty tag that triggered the call, or in the request data.
Parameters: This hook receives it's arguments in the form of a single associative array. The keys for this associative array are below.
module - (string)
The name of the module that is being called.
action - (string)
The name of the action that is being called.
id - (string)
The unique id of the module action call. will be cntnt01 for non-inline module action requests.
News2 Module
Hooks triggred by the News2 module.
Search Module
Hooks triggred by the Search module.
Search::SearchAllItemsDeleted
Called immediately after all items are removed from the search index. Usually on a complete reindex.
Parameters: None
Search::SearchCompleted
Called immediately after a search process is finished.
Related Event: Search::SearchCompleted
Parameters:
(string)
The text provided in the search input field.
(string) - modifiable
The text provided in the search input field.
Search::SearchFilterWords
Called after all other filtering of input, this hook allows postfiltering of search words. Perhaps by language specific stop words etc.
Parameters:
(string[])
An array of search words.
Returns:(string[]|null) - A filtered array of search words. Returning null will not affect the filtered words.
Search::SearchAllItemsDeleted
Called immediately after all indexed words were deleted from the database.
Related Event: Search::SearchAllItemsDeleted
Parameters: None
Search::SearchInitiated
Called immediately after a search process is started, but before any searching is done.
Related Event: Search::SearchInitiated
Parameters:
(string)
The text provided in the search input field.
Returns:(string|null) - A modified search term, or null.
Search::SearchItemAdded
Called immediately before a new search item is added to the database.
Related Event: Search::SearchItemAdded
Parameters:
(string)
The name of the module that the data is associated with.
(string)
An indicator of the type of item that is being indexed.
(string reference) - modifiable
The words that are being indexed.
(integer)
A unix timestamp of the time that this item expires. or null.
Search::SearchItemDeleteed
Called immediately after a search item is removed from the database.
Parameters:
(string)
The name of the module that the data is associated with.
(integer)
The unique identifier for the data to be removed.
(string)
An indicator of the type of data to be removed.
Stylesheets / Templates / Designs
Core::AddDesignPre
Triggered before a new design is saved to the database.
Related Event: Core::AddDesignPre
Parameters: This hook receives it's arguments in the form of a single associative array. The keys for this associative array are below.