Skip to content

All hooks

This is an overview list of all available hooks and the event listeners that are supported for use outside of core. Any event listeners not listed here are not supported for use outside of core & could change without notice

Batch Hooks

Case Hooks

Database Hooks

  • hook_civicrm_alterLocationMergeData - allows you to alter the location information that will be moved from the duplicate contact to the master contact.
  • hook_civicrm_copy - called after a CiviCRM object (Event, ContributionPage, Profile) has been copied.
  • hook_civicrm_custom - called after the database write on a custom table.
  • hook_civicrm_customPre - called before the database write on a custom table.
  • hook_civicrm_managed - allows a module to declare a list of managed entities using the API.
  • hook_civicrm_merge - allows modification of the data used to perform merging of duplicates. It can be useful if your custom module has added its own tables related to CiviCRM contacts. !!! note If your extension has registered entities that have contact ID foreign keys defined correctly in their schema XML, these entities will be automatically handled by the merge process so you don’t need to implement this hook unless you need to do something fancy.
  • hook_civicrm_post - called after a db write on some core objects.
  • hook_civicrm_postCommit - called after the DB commits changes (for certain objects).
  • hook_civicrm_postSave_table_name - called after writing to a database table that has an associated DAO, including core tables but not custom tables or log tables.
  • hook_civicrm_pre - called before a db write on some core objects.
  • hook_civicrm_referenceCounts - called to determine the reference-count for a record.
  • hook_civicrm_triggerInfo - allows you to define MySQL triggers.

Dedupe Hooks

  • hook_civicrm_dupeQuery - called during the dedupe lookup process, and can be used to alter the parameters and queries used to determine if two contacts are duplicates.
  • hook_civicrm_findDuplicates - called when contacts are added/updated via profiles, event registration pages, contribution pages etc. When a form is submitted CiviCRM checks if a contact already exists using one of the built-in deduplication rules and returns a contact ID if a match is found. allows you to override the contact matching rules to implement more complex rules.

Entity Hooks

  • hook_civicrm_entityTypes - used to declare a new type of entity, for example a booking extension might want to declare a Resource entity.

Extension Lifecycle Hooks

Form Hooks

GUI Hooks

  • hook_civicrm_activeTheme - The activeTheme hook determines which theme is active.
  • hook_civicrm_alterBundle - Specify the content of a resource bundle (JS/CSS/etc).
  • hook_civicrm_alterCustomFieldDisplayValue - allows modification of custom field value for an entity eg Individual, Contribution etc before its displayed on screen. This might be useful if you want to alter the value of the custom field that's being displayed on the screen based on some condition.
  • hook_civicrm_alterEntityRefParams - called when an entityRef field is rendered in a form, which allows you to modify the parameters used to fetch options for this kind of field.
  • hook_civicrm_alterMenu - called when building CiviCRM's list of HTTP routes and should be used when you want to register custom paths or URLS.
  • hook_civicrm_alterAdminPanel - invoked after all the panels and items on Administer CiviCRM screen have been generated and allows for direct manipulation of these items and panels.
  • hook_civicrm_buildAmount - called when building the amount structure for a Contribution or Event Page, allowing you to modify the set of radio buttons representing amounts for contribution levels and event registration fees.
  • hook_civicrm_caseSummary - called when the manage case screen is displayed, and it allows the injection of label/value pairs which are rendered inside divs underneath the existing summary table.
  • hook_civicrm_contact_get_displayname - called when retrieving the display name of a contact, allowing you to alter it and return a custom display name.
  • hook_civicrm_customFieldOptions - Deprecated in 4.7 in favor of hook_civicrm_fieldOptions. Use that instead for modifying all option lists, not limited to custom fields.
  • hook_civicrm_dashboard - called when rendering the dashboard page and can be used to add content to the dashboard page.
  • hook_civicrm_dashboard_defaults - called while a contact views their dashboard for the first time and can be used to enable or disable the set of default dashlets.
  • hook_civicrm_entityRefFilters - called when filters and create links for entityRef field is build.
  • hook_civicrm_fieldOptions - allows you to dynamically modify the option list for any field (including custom fields).
  • hook_civicrm_links - Programmatically alter a list of links. called from various screens that display lists of links, including: - Action links at the end of a search result row - Action links on a tabular admin screen - Action links on a tabular contact summary tab - The "Create New" dropdown - The Actions dropdown at the top of a contact record.
  • hook_civicrm_navigationMenu - called after the menus are rebuilt.
  • hook_civicrm_pageRun - called before a CiviCRM page is rendered.
  • hook_civicrm_searchColumns - called after a search is done, allowing you to modify the headers and/or the values that are displayed as part of the search.
  • hook_civicrm_searchTasks - called to display the list of actions allowed after doing a search, allowing you to inject additional actions or to remove existing actions to legacy style searches. For SearchKit searches use hook_civicrm_searchKitTasks.
  • hook_civicrm_searchKitTasks - called to allow you to add to or alter the tasks available in search kit.
  • hook_civicrm_summary - called when the contact summary is rendered, allowing you to modify the summary with your own content.
  • hook_civicrm_summaryActions - allows you to customize the context menu actions on the Contact Summary Page.
  • hook_civicrm_themes - called when building a list of available themes for use within CiviCRM.
  • hook_civicrm_tabs - deprecated in 4.7 & removed in 5.31 in favor of hook_civicrm_tabset.
  • hook_civicrm_tabset - called when composing the tabs interface used for contacts, contributions and events.
  • hook_civicrm_xmlMenu - called when building CiviCRM's menu structure, which is used to render urls in CiviCRM.

Import Hooks

  • hook_civicrm_importAlterMappedRow - allows an import row to be adjusted, after the user configuration has been interpreted into an apiv4-ready format. It is called twice. The first time the usage is validate and the second time the usage is import. In the validate usage you should avoid doing any db lookups or anything resource intensive. Validate mode is intended for a quick pass before presenting the preview screen. For the import usage you can do more intensive lookups and change the data if needed.
  • hook_civicrm_import - deprecated. The description below may be unreliable. We are working to replace it with hook_civicrm_importAlterMappedRow called after contacts have been imported into the system, and before the temp import table has been destroyed.

Mail Hooks

Membership Hooks

Permission Hooks

  • hook_civicrm_aclGroup - called when composing the ACL to restrict access to civicrm entities (civicrm groups, profiles and events).
  • hook_civicrm_aclWhereClause - called when composing the ACL where clause to restrict visibility of contacts to the logged in user. !!! note "Only for Contacts" For all other entities use hook_civicrm_selectWhereClause.
  • hook_civicrm_alterApiRoutePermissions - called when API version 4 permissions are checked. Note that this does not apply to API version 3.
  • hook_civicrm_alterAPIPermissions - called when API version 3 permissions are checked. Note that this does not apply to API version 4.
  • hook_civicrm_invalidateChecksum - allows you to invalidate contact checksums (see It does NOT allow marking a checksum as valid because it could easily open up a security hole - e.g. it could inadvertently allow access to data it shouldn't, especially if multiple extensions implement the hook.
  • hook_civicrm_notePrivacy - !!! warning "Deprecation Notice" deprecated. It will be removed in a future version. called after one or more notes is loaded from the database. It is called once per note, to allow the note to be programmatically hidden. It is now deprecated in favor of hook_civicrm_selectWhereClause.
  • hook_civicrm_permission - Allow custom permissions to be defined. These will appear along with core permissions in the UI and can be granted to user roles. They can be checked using CRM_Core_Permission::check().
  • hook_civicrm_permission_check - called to dynamically alter permissions based on conditions or external criteria.
  • hook_civicrm_permissionList - enumerates special or external permissions, making them available for use in CiviCRM configuration.
  • hook_civicrm_selectWhereClause - allows the permission (ACL) clause of a SELECT query to be altered. It is called for all API-based queries (e.g. SearchKit) but not all legacy queries (e.g. search, report). !!! note "Not for Contacts" For Contact ACLs use hook_civicrm_aclWhereClause.

Profile Hooks

Queue Hooks

  • hook_civicrm_queueActive - Hook to inform background queue processor not to process items. called when a background process attempts to claim an item from the queue to process. A hook could alter the status from 'active' to denote that the server is busy & hence no item should be claimed and processed at this time.
  • hook_civicrm_queueRun - .
  • hook_civicrm_queueStatus - # hook_civicrm_QueueStatus.
  • hook_civicrm_queueTaskError - allows for the modification of how a queue task Error is handled.

Report Hooks

  • hook_civicrm_alterReportVar - used to add or modify display columns and filters. The hooks does not have a well defined contract but CiviReport is not really being developed anymore so it is fairly static. can be used for light modification of CiviReports but in general is is more robust to create your own report template or to use SearchKit instead. In general the CiviReport framework is expected to be replaced by SearchKit As always you should ensure your code has good test cover to avoid breakage on upgrade - especially if you are using getVar() or setVar() to access the internals of the report object.

SMS Hooks

  • hook_civicrm_inboundSMS - called when an inbound SMS has been received, processed by the provider extension, but not matched or processed by CiviSMS.

Scheduled Job / cron Hooks

Token Hooks/listeners

Uncategorized Hooks