Index: trunk/extensions/Newuserlog/Newuserlog.php |
— | — | @@ -26,8 +26,18 @@ |
27 | 27 | array( |
28 | 28 | 'newuserlogpage' => 'User creation log', |
29 | 29 | 'newuserlogpagetext' => 'This is a log of recent user creations', |
| 30 | + |
| 31 | + // Compatibility entries. |
| 32 | + // Old code stored Special:Userlogin as the target, not very helpful. |
30 | 33 | 'newuserlogentry' => '', |
31 | | - 'newuserloglog' => "New user ([[User talk:$1|$2]] | [[Special:Contributions/$1|$3]] | [[Special:Blockip/$1|$4]])" |
| 34 | + 'newuserloglog' => "New user ([[User talk:$1|$2]] | [[Special:Contributions/$1|$3]] | [[Special:Blockip/$1|$4]])", |
| 35 | + |
| 36 | + // Self-login |
| 37 | + 'newuserlog-create-entry' => 'New user', |
| 38 | + 'newuserlog-create-text' => "[[User talk:$1|$2]] | [[Special:Contributions/$1|$3]] | [[Special:Blockip/$1|$4]]", |
| 39 | + |
| 40 | + // Created account for someone else with 'by mail' button |
| 41 | + 'newuserlog-create2-entry' => 'created account for $1', |
32 | 42 | ) |
33 | 43 | ); |
34 | 44 | |
— | — | @@ -41,15 +51,28 @@ |
42 | 52 | $wgHooks['AddNewAccount'][] = 'wfNewuserlogHook'; |
43 | 53 | } |
44 | 54 | |
45 | | -function wfNewuserlogHook() { |
46 | | - global $wgUser, $wgTitle, $wgContLang; |
47 | | - |
| 55 | +function wfNewuserlogHook( $user ) { |
| 56 | + global $wgUser, $wgContLang; |
| 57 | + |
| 58 | + if( is_null( $user ) ) { |
| 59 | + // Compatibility with old versions which didn't pass the parameter |
| 60 | + $user = $wgUser; |
| 61 | + } |
| 62 | + |
48 | 63 | $talk = $wgContLang->getFormattedNsText( NS_TALK ); |
49 | 64 | $contribs = wfMsgForContent( 'contribslink' ); |
50 | 65 | $block = wfMsgForContent( 'blocklink' ); |
| 66 | + $message = wfMsgForContent( 'newuserlog-create-text', |
| 67 | + $user->getName(), $talk, $contribs, $block ); |
51 | 68 | |
| 69 | + if( $user->getName() == $wgUser->getName() ) { |
| 70 | + $action = 'create'; |
| 71 | + } else { |
| 72 | + $action = 'create2'; |
| 73 | + } |
| 74 | + |
52 | 75 | $log = new LogPage( 'newusers' ); |
53 | | - $log->addEntry( 'newusers', $wgTitle, wfMsgForContent( 'newuserloglog', $wgUser->getName(), $talk, $contribs, $block ) ); |
| 76 | + $log->addEntry( $action, $user->getUserPage(), $message ); |
54 | 77 | |
55 | 78 | return true; |
56 | 79 | } |
— | — | @@ -72,6 +95,8 @@ |
73 | 96 | |
74 | 97 | function wfNewuserlogAddActionText( &$actions ) { |
75 | 98 | $actions['newusers/newusers'] = 'newuserlogentry'; |
| 99 | + $actions['newusers/create'] = 'newuserlog-create-entry'; |
| 100 | + $actions['newusers/create2'] = 'newuserlog-create2-entry'; |
76 | 101 | return true; |
77 | 102 | } |
78 | 103 | ?> |