Difference between revisions of "Extension:NewUserMessage.php"

From Organic Design wiki
m
(1.0.1 - add $wgNewUserSupressRC)
Line 7: Line 7:
 
if (!defined('MEDIAWIKI')) die('Not an entry point.');
 
if (!defined('MEDIAWIKI')) die('Not an entry point.');
  
define('NEWUSERMESSAGE_VERSION','1.0.0, 2007-10-15');
+
define('NEWUSERMESSAGE_VERSION','1.0.1, 2008-05-13');
  
$wgNewUserMessageTemplate = 'MediaWiki:NewUserMessage';
+
$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';
 
$wgHooks['AddNewAccount'][] = 'wfCreateNewUserMessage';
Line 22: Line 23:
 
# Add the template message if the users talk page doesn't already exist
 
# Add the template message if the users talk page doesn't already exist
 
function wfCreateNewUserMessage($user) {
 
function wfCreateNewUserMessage($user) {
         global $wgNewUserMessageTemplate;
+
         global $wgNewUserMessageTemplate,$wgNewUserSupressRC;
 
$name = $user->getName();
 
$name = $user->getName();
 
$talk = $user->getTalkPage();
 
$talk = $user->getTalkPage();
 
if (!$talk->exists()) {
 
if (!$talk->exists()) {
 
$article = new Article($talk);
 
$article = new Article($talk);
$article->insertNewArticle('{'.'{'."$wgNewUserMessageTemplate|$name}}",false,false,true,false);
+
$article->insertNewArticle('{'.'{'."$wgNewUserMessageTemplate|$name}}",false,$wgNewUserSupressRC,true,false);
 
}
 
}
 
return true;
 
return true;
 
}
 
}
 
?>
 
?>
 +
$isminor, $watchthis, $suppressRC=false, $comment=false, $bot=false

Revision as of 21:48, 12 May 2008

<?php

  1. Extension:NewUserMessage
Info.svg These are the MediaWiki extensions we're using and/or developing. Please refer to the information on the mediawiki.org wiki for installation and usage details. Extensions here which have no corresponding mediawiki article are either not ready for use or have been superseded. You can also browse our extension code in our local Subversion repository or our GitHub mirror.

Template:Php

  1. - Licenced under LGPL (http://www.gnu.org/copyleft/lesser.html)
  2. - Author: User:NadCategory:Extensions created with Template:Extension
  3. - 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'      => "User:Nad",
       'description' => "Add a message to newly created user's talk pages",
       'url'         => "http://www.mediawiki.org/wiki/Extension:NewUserMessage",
       'version'     => NEWUSERMESSAGE_VERSION
       );
  1. 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; } ?> $isminor, $watchthis, $suppressRC=false, $comment=false, $bot=false