JGonera has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/111112

Change subject: Add hooks in API action=createaccount for Captcha
......................................................................

Add hooks in API action=createaccount for Captcha

New hooks:
* AddNewAccountApiForm
* AddNewAccountApiResult

These hooks are used in ConfirmEdit here: Id628def

Sample API client: https://github.com/brion/api-createaccount

Bug: 46072

Change-Id: If5b7dab80ac85dbfa0f7a54a445356783df5e914
---
M docs/hooks.txt
M includes/api/ApiCreateAccount.php
2 files changed, 13 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/12/111112/1

diff --git a/docs/hooks.txt b/docs/hooks.txt
index bbe1680..b617430 100644
--- a/docs/hooks.txt
+++ b/docs/hooks.txt
@@ -295,6 +295,15 @@
 $user: the User object that was created. (Parameter added in 1.7)
 $byEmail: true when account was created "by email" (added in 1.12)
 
+'AddNewAccountApiForm': Allow modifying internal login form when creating an 
account via API.
+$apiModule: the ApiCreateAccount module calling
+$loginForm: the LoginForm used
+
+'AddNewAccountApiResult': Modify API output when creating a new account via 
API.
+$apiModule: the ApiCreateAccount module calling
+$loginForm: the LoginForm used
+&$result: associative array for API result data
+
 'AfterFinalPageOutput': At the end of OutputPage::output() but before final
 ob_end_flush() which will send the buffered output to the client. This allows
 for last-minute modification of the output within the buffer by using
diff --git a/includes/api/ApiCreateAccount.php 
b/includes/api/ApiCreateAccount.php
index 439f46b..7727b28 100644
--- a/includes/api/ApiCreateAccount.php
+++ b/includes/api/ApiCreateAccount.php
@@ -83,6 +83,7 @@
 
                $loginForm = new LoginForm();
                $loginForm->setContext( $context );
+               wfRunHooks( 'AddNewAccountApiForm', array( $this, $loginForm ) 
);
                $loginForm->load();
 
                $status = $loginForm->addNewaccountInternal();
@@ -159,6 +160,9 @@
                        $result['result'] = 'success';
                }
 
+               // Give extensions a chance to modify the API result data
+               wfRunHooks( 'AddNewAccountApiResult', array( $this, $loginForm, 
&$result ) );
+
                $apiResult->addValue( null, 'createaccount', $result );
        }
 

-- 
To view, visit https://gerrit.wikimedia.org/r/111112
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: If5b7dab80ac85dbfa0f7a54a445356783df5e914
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: wmf/1.23wmf11
Gerrit-Owner: JGonera <[email protected]>
Gerrit-Reviewer: Brion VIBBER <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to