[Mediawiki-l] Options for adding Terms and Conditions upon account creation

Platonides Platonides at gmail.com
Wed Dec 1 18:37:18 UTC 2010


Michael Kingery (HL7) wrote:
> What are the options for adding some text to the account creation
> process? At the very least I need a statement like the below added:
> 
> "By signing up to the wiki you agree to the <link to Acceptable Use
> Policy>"
> 
> Are there any extensions for this or variables I can change? I'd like to
> avoid changing the PHP page that generates this page if possible so that
> it's not lost in future upgrades.
> 
> Thanks!
> 
> - Mike

It's straightforward to add some text there, just edit
includes/templates/Userlogin.php and add the text there, for instance:


			</td>
		</tr>
+<tr><td></td><td>By creating an account I abide to the
+<a href="http://www.example.org/">Terms and Conditions</a></td></tr>
<?php   }

		$tabIndex = 9;
		if ( isset( $this->data['extraInput'] ) && is_array(
$this->data['extraInput'] ) ) {


Doing it in a extension is a bit harder.
You want to hook to UserCreateForm and then call
$template->addInputItem(). It would look like this:

$wgHooks['UserCreateForm'][] = 'efAddTerms';
function efAddTerms(&$template) {
 $template->addInputItem('AUP', false, 'checkbox', 'I abide to the
[[Acceptable Use Policy]]');
 return true;
}

That would add the checkbox. You also need to verify that it was checked:

$wgHooks['AbortNewAccount'][] = 'efAbortIfUnacceptable';
function efAbortIfUnacceptable($user, &$abortError) {
 global $wgRequest;
 $abortError = 'We only accept people which agree with the Acceptable
Use Policy';
 return $wgRequest->getCheck('AUP');
}

Good luck




More information about the MediaWiki-l mailing list