Extension:RedirectOnLogin
From MediaWiki.org
|
Release status: stable |
|||
|---|---|---|---|
| Description | Allows wiki administrators to redirect to a specific page when an user login | ||
| Author(s) | User:DarkonekoTalk | ||
| Last Version | 1.1 (30/07/2008) | ||
| MediaWiki | tested on 1.12.0 (1.4+ theorically) | ||
| License | pubblic domain | ||
| Download | Extension:RedirectOnLogin#Extension_code | ||
|
|||
|
|||
|
check usage (experimental) |
|||
This little extension allow you, when an user login successfully, to redirect him directly to a page of your choice instead of the usual "you are now logged in" page.
Contents |
[edit] Compatibility
This was created for MW 1.12.0 and is currently untested on others (please update this page when you try it on other versions), but it should work fine as long as the 'UserLoginComplete' hook (1.4+) and $wgOut->redirect() exists.
- Tested on
- 1.12.0
- 1.13.1
- 1.14
[edit] Extension call
//absolute path from web root. Can also be an URL require_once("extensions/redirectOnLogin.php"); $wgPageToRedirectOnLogin = "/path_to_mediawiki/index.php?title=yourpage";
[edit] Extension code
Create a page at "extensions/redirectOnLogin.php" with the following content
<?php //not called from the software = no can do. 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'=>'redirectOnLogin', 'version'=> '1.1', 'author'=>'Wolfgang ten Weges', // [[fr:user:Darkoneko]] 'url'=>'http://www.mediawiki.org/wiki/Extension:RedirectOnLogin', 'description' => 'Redirect to any page you want on login' ); //URL to redirect on successful login $wgPageToRedirectOnLogin = ''; $wgHooks['UserLoginComplete'][] = 'redirectOnLogin'; function redirectOnLogin(&$user) { global $wgOut, $wgPageToRedirectOnLogin; $wgOut->redirect( $wgPageToRedirectOnLogin ); return true; }