|
|
Line 1: |
Line 1: |
− | <?php
| + | {{svn|http://svn.wikimedia.org/svnroot/mediawiki/trunk/extensions/NewUserMessage}} |
− | # Extension:NewUserMessage{{Category:Extensions|NewUserMessage}}{{php}}
| |
− | # - Licenced under LGPL (http://www.gnu.org/copyleft/lesser.html)
| |
− | # - Author: [http://www.organicdesign.co.nz/nad User:Nad]{{Category:Extensions created with Template:Extension}}
| |
− | # - Started: 2007-10-15
| |
− | | |
− | if (!defined('MEDIAWIKI')) die('Not an entry point.');
| |
− | | |
− | define('NEWUSERMESSAGE_VERSION','1.0.1, 2008-05-13');
| |
− | | |
− | $wgNewUserMessageTemplate = 'MediaWiki:NewUserMessage'; # Template to wrap message in
| |
− | $wgNewUserSupressRC = false; # Set to true to prevent new user message creation showing in recent changes
| |
− | | |
− | $wgHooks['AddNewAccount'][] = 'wfCreateNewUserMessage';
| |
− | $wgExtensionCredits['other'][] = array(
| |
− | 'name' => "NewUserMessage",
| |
− | 'author' => "[http://www.organicdesign.co.nz/User:Nad User:Nad]",
| |
− | 'description' => "Add a message to newly created user's talk pages",
| |
− | 'url' => "http://www.mediawiki.org/wiki/Extension:NewUserMessage",
| |
− | 'version' => NEWUSERMESSAGE_VERSION
| |
− | );
| |
− | | |
− | # Add the template message if the users talk page doesn't already exist
| |
− | function wfCreateNewUserMessage($user) {
| |
− | global $wgNewUserMessageTemplate,$wgNewUserSupressRC;
| |
− | $name = $user->getName();
| |
− | $talk = $user->getTalkPage();
| |
− | if (!$talk->exists()) {
| |
− | $article = new Article($talk);
| |
− | $article->insertNewArticle('{'.'{'."$wgNewUserMessageTemplate|$name}}",false,$wgNewUserSupressRC,true,false);
| |
− | }
| |
− | return true;
| |
− | }
| |