Extension hook registry

From MediaWiki.org
Jump to: navigation, search

The Hooks mechanism in MediaWiki is a powerful tool for extension authors to modify the behavior of MediaWiki while minimizing, if not eliminating, the need to hack the codebase. A logical extension of this idea is to place hooks in extensions themselves, in order to allow other developers to extend the extensions. This page provides a listing and documentation for hooks provided by extension authors. To document your hook:

  1. create a page named after the hook under your extension, e.g. Extension:MyExtension/MyHook. Note: this naming convention allows defaults and category links in Template:Extension and Template:SeeCustomHook to work properly
  2. place the Template:Extension in your page and fill in the parameter values
  3. add a row for your hook in the table below

Extension hooks by parent extension[edit | edit source]

Parent extension Version
Hook Description
ArticleComments 0.4 r73901 ArticleCommentsSpamCheck Called on comment submission for spam detection.
Backup Backup Hook event called when a page change is effected
CategoryHook 0.2 CategoryHook Adds a hook allowing articles to be added to additional categories based on wikitext content.
CentralAuth 1.13 CentralAuthWikiList Get the list of wikis in which CentralAuth is active
ContactPage ContactForm Can be used to manipulate most of the values related to the contact message: the sender, the receiver, the subject and the actual contact message text.
ContactPage r60638 ContactFormBeforeMessage Can be used to add new fields to Special:Contact. Two parameters, $contactForm (Object; instance of EmailContactForm class) and &$form (HTML used to generate the form).
ContactPage ContactFromComplete Takes the same parameters as ContactForm hook does.
DatabaseFetchObject 0.1 DatabaseFetchObject Hook for checking permissions in any context where database page contents are retrieved.
Echo BeforeCreateEchoEvent Allows registration of custom Echo events
EmailDomainCheck 0.1 EmailDomainCheck Only allows registrations from a specific email domain
GoogleNewsSitemap GoogleNewsSitemap::Query Modifies the query used by GoogleNewsSitemap (used for flagged revs support)
ImagePageEx ImagePageEx Hooks for trapping delete related changes in NS_IMAGE
LDAP Authentication 1.1c+ SetUsernameAttributeFromLDAP Allows hook function to set the LDAP username from various attributes returned by a query.
MobileFrontend 3b5e3c07f39ef070389a00597b996912f47cad7b EnableMobileModules Allow other extensions to add modules depending on the MobileFrontend mode
NewUserMessage 3.1 CreateNewUserMessage Hook for modules that allows them to override the default new user message.
PagesOnDemand 0.1 PagesOnDemand Hook for modules that create new pages from templates when links to nonexistent pages are followed
Renameuser 1.11 RenameUserAbort Allow other extensions to abort a user rename
Renameuser 1.11 RenameUserComplete After a successful user rename
Renameuser 1.13 RenameUserPreRename Before renaming a user
Renameuser r55189 RenameUserSQL In the constructor of RenameuserSQL class, allows adding tables to the array of tables that Renameuser should update on rename
Renameuser 1.13 RenameUserWarning Get warnings when renaming a user
Shibboleth Authentication ShibUpdateUser Hook event called before user information gets updated on login (for setting the name/mail from Shibboleth)
UserMerge 1.6.21 1.19 r89147 DeleteAccount Trigger update actions elsewhere (e.g. in OpenID) when UserMerge has deleted an account
UserMerge 1.6.21 1.19 r89147 MergeAccountFromTo Trigger update actions elsewhere (e.g. in OpenID) when UserMerge has merged one account to another
SphinxSearch 0.7.2 r73342 SphinxSearchBeforeResults Control various search parameters before search client is instantiated
SphinxSearch 0.7.2 r73342 SphinxSearchBeforeQuery Control search term and sphinx client before search is executed

Extensions: CategoryAllRequestsTag extensionsExtension MatrixExtensions FAQExtension hook registryExtension namespace registry