Index: trunk/extensions/NewUserMessage/NewUserMessage.class.php |
— | — | @@ -21,23 +21,20 @@ |
22 | 22 | $talk = $user->getTalkPage(); |
23 | 23 | |
24 | 24 | if (!$talk->exists()) { |
25 | | - global $wgUser, $wgNewUserMinorEdit; |
| 25 | + global $wgUser, $wgNewUserMinorEdit, $wgNewUserSuppressRC; |
26 | 26 | |
27 | 27 | wfLoadExtensionMessages( 'NewUserMessage' ); |
28 | 28 | |
29 | 29 | $article = new Article($talk); |
30 | 30 | |
31 | | - // Need to make the edit on the user talk page in another |
32 | | - // user's context. Park the current user object and create |
33 | | - // a user object for $editingUser. If that user does not |
34 | | - // exist, create it. |
35 | | - $parkedWgUser = $wgUser; |
36 | | - $wgUser = User::newFromName( wfMsgForContent( 'newusermessage-editor' ) ); |
37 | | - if ( !$wgUser->isLoggedIn() ) { |
38 | | - $wgUser->addToDatabase(); |
| 31 | + // Create a user object for the editing user and add it to the database |
| 32 | + // if it's not there already |
| 33 | + $editor = User::newFromName( wfMsgForContent( 'newusermessage-editor' ) ); |
| 34 | + if ( !$editor->isLoggedIn() ) { |
| 35 | + $editor->addToDatabase(); |
39 | 36 | } |
40 | 37 | |
41 | | - $flags = EDIT_NEW | EDIT_SUPPRESS_RC; |
| 38 | + $flags = EDIT_NEW; |
42 | 39 | $templateTitleText = wfMsg( 'newusermessage-template' ); |
43 | 40 | $templateTitle = Title::newFromText( $templateTitleText ); |
44 | 41 | if ( !$templateTitle ) { |
— | — | @@ -48,6 +45,7 @@ |
49 | 46 | $templateTitleText = $templateTitle->getText(); |
50 | 47 | } |
51 | 48 | if ($wgNewUserMinorEdit) $flags = $flags | EDIT_MINOR; |
| 49 | + if ($wgNewUserSuppressRC) $flags = $flags | EDIT_SUPPRESS_RC; |
52 | 50 | |
53 | 51 | $dbw = wfGetDB( DB_MASTER ); |
54 | 52 | $dbw->begin(); |
— | — | @@ -65,7 +63,7 @@ |
66 | 64 | } |
67 | 65 | } |
68 | 66 | try { |
69 | | - $article->doEdit( $text, wfMsgForContent( 'newuseredit-summary' ), $flags ); |
| 67 | + $article->doEdit( $text, wfMsgForContent( 'newuseredit-summary' ), $flags, false, $editor ); |
70 | 68 | } catch ( DBQueryError $e ) { |
71 | 69 | $good = false; |
72 | 70 | } |
— | — | @@ -79,7 +77,6 @@ |
80 | 78 | wfDebug( __METHOD__. ": the article has already been created despite !\$talk->exists()\n" ); |
81 | 79 | $dbw->rollback(); |
82 | 80 | } |
83 | | - $wgUser = $parkedWgUser; |
84 | 81 | } |
85 | 82 | return true; |
86 | 83 | } |