Extension:RedirectOnAccountCreation

From MediaWiki.org

Jump to: navigation, search

           

Manual on MediaWiki Extensions
List of MediaWiki Extensions
Crystal Clear action run.png
RedirectOnAccountCreation

Release status: stable

Description Allows wiki administrators to redirect to a specific page after a user has created a new account
Author(s)  User:MaziminkeTalk
Last Version  1.0 (01/12/2008)
MediaWiki  tested on 1.14a and 1.13.2
License public domain
Download see "Extension code"

check usage (experimental)

This is an adaption of the RedirectOnLogin extension which allows you to redirect a user to a certain wiki page after having created a new account.

Contents

[edit] Compatibility

The extension was created for MW 1.14a and 1.13.2 and is currently untested on others. Nevertheless this extension should work fine on all mediawikis which support AddNewAccounthook and $wgOut->redirect().

Please update this page when you have tested the extension on other versions.

Tested on
  • 1.14a
  • 1.13.2
  • ... (please add other tested versions)

[edit] Extension call

Please add the following lines to your Localsettings.php file and adapt them:

//absolute path from web root
require_once("extensions/redirectOnAccountCreation.php");
 
//wiki page to redirect to (adjust path and page title)
$wgPageToRedirectOnAccountCreation = "/path_to_mediawiki/index.php?title=yourpage";

[edit] Extension code

Create a page at "extensions/redirectOnAccountCreation.php.php" with the following content:

<?php
//not called from the software -> show warning
if( ! defined( 'MEDIAWIKI' ) ) {
    echo( "This file is an extension to the MediaWiki software, and cannot be used standalone.\n" );
    die( 1 );
}
 
$wgExtensionCredits['other'][] = array(
    'name'=>'redirectOnAccountCreation',
    'version'=> '1.0',
    'author'=>'Marcel Minke', // [[de:user:Maziminke]]
    'url'=>'http://www.mediawiki.org/wiki/extensions:RedirectOnAccountCreation',
    'description' => 'Redirect to a certain page after user has created a new account'
);
 
 
 
//wiki page to redirect to (adjust path and page title)
$wgPageToRedirectOnAccountCreation = "/path_to_mediawiki/index.php?title=yourpage"; 
 
$wgHooks['AddNewAccount'][] = 'redirectOnAccountCreation';
 
function redirectOnAccountCreation(&$user) {
        global $wgOut, $wgPageToRedirectOnAccountCreation;
        $wgOut->redirect( $wgPageToRedirectOnAccountCreation );        
 
        return true;
}

[edit] Similiar extensions