Manual:Hooks/AddNewAccountApiResult

From MediaWiki.org
Jump to navigation Jump to search
AddNewAccountApiResult
Available from version 1.23.0 (Gerrit change 106844)
Removed in version 1.27
Modifies the API output when an account is created via the API.
Define function:
public static function onAddNewAccountApiResult( $apiModule, $loginForm, &$result ) { ... }
Attach hook:

In extension.json:

{
	"Hooks": {
		"AddNewAccountApiResult": "MyExtensionHooks::onAddNewAccountApiResult"
	}
}

For MediaWiki ≤1.25:

$wgHooks['AddNewAccountApiResult'][] = 'MyExtensionHooks::onAddNewAccountApiResult';
Called from:File(s): ApiCreateAccount.php

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

In MediaWiki 1.27, the hook has been removed and replaced by AuthManager functionality. Extensions which support AuthManager don't need to do anything special, API support is built in. If you want to provide extra information for the API before registration, use AuthenticationRequest::getMetadata().