Manual:Hooks/ChangePasswordForm

From MediaWiki.org
Jump to navigation Jump to search
ChangePasswordForm
Available from version 1.20.0
Removed in version 1.34.0
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": "MyExtensionHooks::onChangePasswordForm"
	}
}

For MediaWiki ≤1.25:

$wgHooks['ChangePasswordForm'][] = 'MyExtensionHooks::onChangePasswordForm';
Called from:File(s): specials/SpecialChangeCredentials.php
Function(s): onAuthChangeFormFields

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.