Jump to content

Manual:Hooks/ChangePasswordForm

From mediawiki.org
ChangePasswordForm
Available from version 1.20.0
Removed in version 1.34.0 (Gerrit change 520327)
For extensions that need to add a field to the ChangePassword form via the Preferences form.
Define function:
public static function onChangePasswordForm( array &$extraFields ) { ... }
Attach hook: In extension.json:
{
	"Hooks": {
		"ChangePasswordForm": "MediaWiki\\Extension\\MyExtension\\Hooks::onChangePasswordForm"
	}
}
Called from: File(s): specials/SpecialChangeCredentials.php
Function(s): onAuthChangeFormFields
Interface: ChangePasswordFormHook.php

For more information about attaching hooks, see Manual:Hooks .
For examples of extensions using this hook, see Category:ChangePasswordForm extensions.


Details

[edit]
  • &$extraFields: An array of arrays, each containing [<type>, <name>, <label-message>, <default>]; see HTMLForm for the meaning of each field.

Deprecated

[edit]

From MediaWiki 1.27 on, the hook is deprecated and superseded by AuthManager functionality. Adding fields to the password change form is not supported anymore. An authentication provider can prevent password change or react to it with its providerAllowsAuthenticationDataChange and providerChangeAuthenticationData methods, respectively. The AuthChangeFormFields hook can be used for cosmetic modifications of the form.