Manual:Hooks/AbortNewAccount

From MediaWiki.org
Jump to: navigation, search
AbortNewAccount
Available from version 1.5.8
Can be used to cancel user account creation
Define function:
public static function onAbortNewAccount( $user, &$message ) { ... }
Attach hook:
$wgHooks['AbortNewAccount'][] = 'MyExtensionHooks::onAbortNewAccount';
Called from: File(s): SpecialUserlogin.php

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

Details[edit]

  • $user: the User object about to be created (read-only, incomplete)
  • $message: out parameter: error message to display on abort

Notes[edit]

  • Return false to cancel account creation.

Deprecated[edit]

From MediaWiki 1.27 on, the hook is deprecated and superseded by AuthManager functionality. Any logic in it should probably be moved to a class implementing PreAuthenticationProvider, into the testForAccountCreation and testUserForCreation methods.