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 further extend those extensions. This page provides a listing and documentation for hooks provided by extension authors.

To document an extension 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. Add a row for your hook in the table below.

Extension hooks by parent extension[edit]

Parent extension Version
Revision Hook Description
Admin Links AdminLinks Allows for adding sections and links to the Special:AdminLinks page.
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.
Nuke 1.27.0 NukeGetNewPages Called after searching for pages to delete; can be used to add and remove pages.
Nuke 1.27.0 NukeDeletePage Allows other extensions to handle the deletion of titles.
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
Semantic Forms 3.4 and below sfAddJavascriptFiles Allows for adding additional JavaScript files to forms. Obsolete.
Semantic Forms 3.5 and below sfAddJavascriptToForm Allows for adding additional inline JavaScript to the form. Obsolete.
Semantic Forms 3.5+ sfAddResourceLoaderModules Allows for adding additional ResourceLoader modules to forms
Semantic Forms sfBeforeFreeTextSubstitution Allows for modifying the free text field
Semantic Forms sfCreateFormField Allows for modifying a form field
Semantic Forms SFCreateTemplateText Called when generating a template via one of the helper pages
Semantic Forms sfEditFormPreloadText Can be used to set or change the preload text, for new pages
Semantic Forms sfFormPrinterSetup Called as part of the form setup
Semantic Forms sfHTMLBeforeForm Can be used to insert additional HTML at the beginning of the form
Semantic Forms sfModifyFreeTextField Allows for modifying the free text field (deprecated)
Semantic Forms sfPrintRedirectForm Can be used to modify the mini-form that redirects users to the real form
Semantic Forms sfRenderingEnd Called at the end of the form display
Semantic Forms sfSetTargetName Can be used to set the "target" page name, based on a passed-in page name
Semantic Forms SFTemplateFieldStart Called before generating a field in an automatically-generated template page
Semantic Forms SFTemplateFieldEnd Called after generating a field in an automatically-generated template page
Semantic Forms sfUserCanEditPage Can be used to set whether a user can edit a page
Semantic Forms sfWritePageData Can be used to process addiitional form-definition syntax outside of what SF handles
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
MathSearch MathSearchGenerateAnchorString allows for customization of formula Ids that are not set explicitly by the user

ExtensionsManual:Extensions: Category:Category:ExtensionsAll:Category:All extensionsRequestsTag extensionsManual:Tag extensionsExtensions FAQExtensions FAQExtension hook registryExtension default namespaces