Index: trunk/extensions/NewUserMessage/NewUserMessage.i18n.php |
— | — | @@ -12,6 +12,11 @@ |
13 | 13 | */ |
14 | 14 | $messages['en'] = array( |
15 | 15 | 'newusermessage-desc' => "Adds a [[MediaWiki:NewUserMessage|message]] to newly created user's talk pages", |
| 16 | + 'newuseredit-summary' => 'Adding [[{{MediaWiki:Newusermessage-template}}|welcome message]] to new user\'s talk page', |
| 17 | + |
| 18 | + // Configuration (should not be translated) |
| 19 | + 'newusermessage-template' => 'MediaWiki:NewUserMessage', # do not translate this message to other languages |
| 20 | + 'newusermessage-editor' => 'MediaWiki default', # do not translate this message to other languages |
16 | 21 | ); |
17 | 22 | |
18 | 23 | /** Afrikaans (Afrikaans) |
Index: trunk/extensions/NewUserMessage/NewUserMessage.php |
— | — | @@ -12,24 +12,11 @@ |
13 | 13 | if (!defined('MEDIAWIKI')) |
14 | 14 | die('Not an entry point.'); |
15 | 15 | |
16 | | -define('NEWUSERMESSAGE_VERSION','1.2.1, 2008-06-04'); |
| 16 | +define('NEWUSERMESSAGE_VERSION','2.0, 2008-06-04'); |
17 | 17 | |
18 | | -// Specify a template to wrap the new user message within |
19 | | -$wgNewUserMessageTemplate = 'MediaWiki:NewUserMessage'; |
| 18 | +$wgNewUserSupressRC = false; // Specify whether or not the new user message creation should show up in recent changes |
| 19 | +$wgNewUserMinorEdit = true; // Should the new user message creation be a minor edit? |
20 | 20 | |
21 | | -// Set the username of the user that makes the edit on user talk pages. If |
22 | | -// this user does not exist, the new user will show up as editing user. |
23 | | -$wgNewUserMessageEditor = 'Admin'; |
24 | | - |
25 | | -// Edit summary for the recent changes entry of a new users message |
26 | | -$wgNewUserEditSummary = "Adding [[$wgNewUserMessageTemplate|welcome message]] to new user's talk page"; |
27 | | - |
28 | | -// Specify whether or not the new user message creation should show up in recent changes |
29 | | -$wgNewUserSupressRC = false; |
30 | | - |
31 | | -// Should the new user message creation be a minor edit? |
32 | | -$wgNewUserMinorEdit = true; |
33 | | - |
34 | 21 | $dir = dirname(__FILE__) . '/'; |
35 | 22 | $wgExtensionMessagesFiles['NewUserMessage'] = $dir . 'NewUserMessage.i18n.php'; |
36 | 23 | $wgAutoloadClasses['NewUserMessage'] = $dir . 'NewUserMessage.class.php'; |
— | — | @@ -39,7 +26,7 @@ |
40 | 27 | $wgExtensionCredits['other'][] = array( |
41 | 28 | 'name' => 'NewUserMessage', |
42 | 29 | 'version' => NEWUSERMESSAGE_VERSION, |
43 | | - 'author' => "[http://www.organicdesign.co.nz/User:Nad Nad]", |
| 30 | + 'author' => array( "[http://www.organicdesign.co.nz/User:Nad Nad]", 'Siebrand Mazeland' ), |
44 | 31 | 'description' => "Add a [[MediaWiki:NewUserMessage|message]] to newly created user's talk pages", |
45 | 32 | 'descriptionmsg' => 'newusermessage-desc', |
46 | 33 | 'url' => 'http://www.mediawiki.org/wiki/Extension:NewUserMessage', |
Index: trunk/extensions/NewUserMessage/NewUserMessage.class.php |
— | — | @@ -21,26 +21,31 @@ |
22 | 22 | $talk = $user->getTalkPage(); |
23 | 23 | |
24 | 24 | if (!$talk->exists()) { |
25 | | - global $wgUser, $wgNewUserMessageEditor, $wgNewUserMessageTemplate, |
26 | | - $wgNewUserMinorEdit, $wgNewUserSupressRC, $wgNewUserEditSummary; |
| 25 | + global $wgUser, $wgNewUserMinorEdit, $wgNewUserSupressRC; |
27 | 26 | |
| 27 | + wfLoadExtensionMessages( 'NewUserMessage' ); |
| 28 | + |
28 | 29 | $article = new Article($talk); |
29 | 30 | |
30 | 31 | // Need to make the edit on the user talk page in another |
31 | 32 | // user's context. Park the current user object and create |
32 | | - // a user object for $wgNewUserMessageEditor. If that user |
33 | | - // does not exist, make the edit as the new user anyway. |
| 33 | + // a user object for $editingUser. If that user does not |
| 34 | + // exist, make the edit as reserved user |
| 35 | + // "MediaWiki default". |
34 | 36 | $parkedWgUser = $wgUser; |
35 | | - $wgUser = User::newFromName( $wgNewUserMessageEditor ); |
36 | | - if ( !$wgUser->idForName() ) { |
37 | | - $wgUser = $parkedWgUser; |
| 37 | + $editingUser = wfMsg( 'newusermessage-editor' ); |
| 38 | + if( User::idFromName( $editingUser ) ) { |
| 39 | + $wgUser = User::newFromName( $editingUser ); |
38 | 40 | } |
| 41 | + else |
| 42 | + $wgUser = User::newFromName( "MediaWiki default" ); |
39 | 43 | |
40 | 44 | $flags = 0; |
| 45 | + $messageTemplate = wfMsg( 'newusermessage-template' ); |
41 | 46 | if ($wgNewUserMinorEdit) $flags = $flags | EDIT_MINOR; |
42 | 47 | if ($wgNewUserSupressRC) $flags = $flags | EDIT_SUPPRESS_RC; |
43 | 48 | |
44 | | - $article->doEdit('{'.'{'."$wgNewUserMessageTemplate|$name}}", $wgNewUserEditSummary, $flags); |
| 49 | + $article->doEdit('{'.'{'."$messageTemplate|$name}}", wfMsg( 'newuseredit-summary' ), $flags); |
45 | 50 | $wgUser = $parkedWgUser; |
46 | 51 | } |
47 | 52 | return true; |
Index: trunk/extensions/Translate/groups/mediawiki-defines.txt |
— | — | @@ -422,6 +422,7 @@ |
423 | 423 | ignored = newuserlogentry |
424 | 424 | |
425 | 425 | New User Message |
| 426 | +ignored = newusermessage-template, newusermessage-editor |
426 | 427 | |
427 | 428 | New User Notification |
428 | 429 | file = NewUserNotif/NewUserNotif.i18n.php |