Manual:Hooks/UserCreateForm

From Linux Web Expert

UserCreateForm
<translate> Available from <tvar name=1><translate> version <tvar </tvar></translate>
<translate> Removed in <tvar name=1><translate> version <tvar (Gerrit change 441513)</tvar></translate>
Manipulate the user create form
<translate> Define function:</translate>
public static function onUserCreateForm( &$template ) { ... }
<translate> Attach hook:</translate> <translate> In <tvar name=1>extension.json</tvar>:</translate>
{
	"Hooks": {
		"UserCreateForm": "MediaWiki\\Extension\\MyExtension\\Hooks::onUserCreateForm"
	}
}
<translate> Called from:</translate> <translate> File(s):</translate> specials/SpecialUserLogin.php
<translate> Interface:</translate> UserCreateFormHook.php

<translate> For more information about attaching hooks, see <tvar name=1>Manual:Hooks </tvar>.</translate>
<translate> For examples of extensions using this hook, see <tvar name=cat>Category:UserCreateForm extensions</tvar>.</translate>

Details

  • &$template: SimpleTemplate instance for the form

Deprecated

From MediaWiki 1.27 on, the hook is deprecated and superseded by AuthManager functionality. User creation form fields should be added by some authentication provider returning an instance of an appropriate AuthenticationRequest subclass instance in getAuthenticationRequests(), and that object can define the fields via getFieldInfo(). The authentication provider can read the submitted data from the AuthenticationRequest object via its testForAccountCreation or beginPrimaryAccountCreation/continuePrimaryAccountCreation methods.

For purely cosmetic changes to the form, which don't need to be reflected to the API (such as adding more information or interactive widgets) the AuthChangeFormFields hook can be used.

See also