'AbortNewAccount': Return false to cancel explicit account creation.
$user: the User object about to be created (read-only, incomplete)
&$msg: out parameter: HTML to display on abort
+&$status: out parameter: Status object to return, replaces the older $msg param (added in 1.23)
+ Create the object with Status::newFatal() to ensure proper API error messages
+ are returned when creating account through API clients.
'AbortTalkPageEmailNotification': Return false to cancel talk page email notification
$targetUser: the user whom to send talk page email notification
$u->setRealName( $this->mRealName );
$abortError = '';
- if ( !wfRunHooks( 'AbortNewAccount', array( $u, &$abortError ) ) ) {
+ $abortStatus = null;
+ if ( !wfRunHooks( 'AbortNewAccount', array( $u, &$abortError, &$abortStatus ) ) ) {
// Hook point to add extra creation throttles and blocks
wfDebug( "LoginForm::addNewAccountInternal: a hook blocked creation\n" );
- $abortError = new RawMessage( $abortError );
- $abortError->text();
- return Status::newFatal( $abortError );
+ if ( $abortStatus === null ) {
+ // Report back the old string as a raw message status.
+ // This will report the error back as 'createaccount-hook-aborted'
+ // with the given string as the message.
+ // To return a different error code, return a Status object.
+ $abortError = new Message( 'createaccount-hook-aborted', array( $abortError ) );
+ $abortError->text();
+ return Status::newFatal( $abortError );
+ } else {
+ // For MediaWiki 1.23+ and updated hooks, return the Status object
+ // returned from the hook.
+ return $abortStatus;
+ }
}
// Hook point to check for exempt from account creation throttle
'cantcreateaccount-text' => "Account creation from this IP address ('''$1''') has been blocked by [[User:$3|$3]].
The reason given by $3 is ''$2''",
+'createaccount-hook-aborted' => '$1', # do not translate or duplicate this message to other languages
# History pages
'viewpagelogs' => 'View logs for this page',
* $2 - reason or {{msg-mw|Blockednoreason}}
* $3 - username
* $4 - current user's IP address",
+'createaccount-hook-aborted' => 'Placeholder message to return with API errors on account create; passes through the message from a hook {{notranslate}}',
# History pages
'viewpagelogs' => 'Link displayed in history of pages',
'autocomment-prefix',
'move-redirect-text',
'interlanguage-link-title-langonly',
+ 'createaccount-hook-abort',
);
/** Optional messages, which may be translated only if changed in the target language. */