https://www.mediawiki.org/wiki/Special:Code/MediaWiki/115455
Revision: 115455
Author: vedmaka
Date: 2012-05-29 08:00:00 +0000 (Tue, 29 May 2012)
Log Message:
-----------
New hooks which make possible control of sign up workflow:
- SemanticSignupBeforeRedirect
Fired before redirect to Special:SemanticSignup, allows to
change redirect url.
- SemanticSignupUserSignup
Fired on form submit, before mUserDataChecker->run(). Allows to
change user rights before checks run.
- SemanticSignupPrintForm
Fired before form build, allows to change form output.
- SemanticSignupUserSignupSpecial
Fired on Special:SemanticSignup execute, allows to dynamic page
access control
When I needed to write an invitation system extension, i realized that
SemanticSignup lack of workflow control hooks. I suggest this hooks, which i
added to write invitation system extension.
Modified Paths:
--------------
trunk/extensions/SemanticSignup/SemanticSignup.hooks.php
trunk/extensions/SemanticSignup/includes/SES_Special.php
Modified: trunk/extensions/SemanticSignup/SemanticSignup.hooks.php
===================================================================
--- trunk/extensions/SemanticSignup/SemanticSignup.hooks.php 2012-05-29
07:13:31 UTC (rev 115454)
+++ trunk/extensions/SemanticSignup/SemanticSignup.hooks.php 2012-05-29
08:00:00 UTC (rev 115455)
@@ -26,6 +26,9 @@
}
$url = SemanticSignup::getTitleFor( 'SemanticSignup'
)->escapeFullURL();
+
+ wfRunHooks('SemanticSignupBeforeRedirect', array( &$url ) );
+
global $wgOut;
$wgOut->redirect( $url );
Modified: trunk/extensions/SemanticSignup/includes/SES_Special.php
===================================================================
--- trunk/extensions/SemanticSignup/includes/SES_Special.php 2012-05-29
07:13:31 UTC (rev 115454)
+++ trunk/extensions/SemanticSignup/includes/SES_Special.php 2012-05-29
08:00:00 UTC (rev 115455)
@@ -25,6 +25,10 @@
}
private function userSignup() {
+
+ //Hook for dynamic signup control
+ wfRunHooks('SemanticSignupUserSignup');
+
// Get user input and check the environment
$this->mUserDataChecker->run();
@@ -157,6 +161,9 @@
list ( $form_text, $javascript_text, $data_text,
$form_page_title, $generated_page_name ) =
$sfgFormPrinter->formHTML( $form_definition, false,
false );
+ /* Run hook allow externals to modify output of form */
+ wfRunHooks('SemanticSignupPrintForm', array( &$form_text,
&$javascript_text, &$data_text, &$form_page_title, &$generated_page_name ) );
+
$text = <<<END
<form name="createbox" onsubmit="return
validate_all()" action="" method="post" class="createbox">
END;
@@ -241,6 +248,9 @@
$this->setHeaders();
+ //Hook for dynamic control page access
+ if(!wfRunHooks('SemanticSignupUserSignupSpecial')) return true;
+
if ( $wgRequest->getCheck( 'wpSave' ) ) {
return $this->executeOnSubmit();
} else {
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs