Manual:Hooks/AddNewAccount

Category:MediaWiki hooks#AddNewAccount Category:Hooks added in MediaWiki 1.5.0#AddNewAccount Category:MediaWiki deprecated or obsolete features#AddNewAccount Category:Hooks deprecated in MediaWiki 1.27.0#AddNewAccount
AddNewAccount
Available from version 1.5.0
Called after a user account is created
Define function:
public static function onAddNewAccount( User $user, $byEmail ) { ... }
Attach hook: In extension.json:
{
	"Hooks": {
		"AddNewAccount": "MediaWiki\\Extension\\MyExtension\\Hooks::onAddNewAccount"
	}
}
Called from: File(s): specials/SpecialUserLogin.phpCategory:MediaWiki hooks included in SpecialUserLogin.php#AddNewAccount
Interface: AddNewAccountHook.php

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

Details

  • $user: the User object that was created. (introduced in 1.7)
  • $byEmail: true when account was created "by email" (introduced in 1.12)

This does not include accounts auto-created by authentication extensions like CentralAuth. For that, see AuthPluginAutoCreate.

Category:Hooks added in MediaWiki 1.5.0 Category:Hooks deprecated in MediaWiki 1.27.0 Category:MediaWiki deprecated or obsolete features Category:MediaWiki hooks Category:MediaWiki hooks included in SpecialUserLogin.php