Index: trunk/phase3/includes/User.php |
— | — | @@ -3571,28 +3571,34 @@ |
3572 | 3572 | |
3573 | 3573 | /** |
3574 | 3574 | * Add a newuser log entry for this user |
| 3575 | + * |
3575 | 3576 | * @param $byEmail Boolean: account made by email? |
| 3577 | + * @param $reason String: user supplied reason |
3576 | 3578 | */ |
3577 | | - public function addNewUserLogEntry( $byEmail = false ) { |
3578 | | - global $wgUser, $wgNewUserLog; |
| 3579 | + public function addNewUserLogEntry( $byEmail = false, $reason = '' ) { |
| 3580 | + global $wgUser, $wgContLang, $wgNewUserLog; |
3579 | 3581 | if( empty( $wgNewUserLog ) ) { |
3580 | 3582 | return true; // disabled |
3581 | 3583 | } |
3582 | 3584 | |
3583 | 3585 | if( $this->getName() == $wgUser->getName() ) { |
3584 | 3586 | $action = 'create'; |
3585 | | - $message = ''; |
3586 | 3587 | } else { |
3587 | 3588 | $action = 'create2'; |
3588 | | - $message = $byEmail |
3589 | | - ? wfMsgForContent( 'newuserlog-byemail' ) |
3590 | | - : ''; |
| 3589 | + if ( $byEmail ) { |
| 3590 | + if ( $reason === '' ) { |
| 3591 | + $reason = wfMsgForContent( 'newuserlog-byemail' ); |
| 3592 | + } else { |
| 3593 | + $reason = $wgContLang->commaList( array( |
| 3594 | + $reason, wfMsgForContent( 'newuserlog-byemail' ) ) ); |
| 3595 | + } |
| 3596 | + } |
3591 | 3597 | } |
3592 | 3598 | $log = new LogPage( 'newusers' ); |
3593 | 3599 | $log->addEntry( |
3594 | 3600 | $action, |
3595 | 3601 | $this->getUserPage(), |
3596 | | - $message, |
| 3602 | + $reason, |
3597 | 3603 | array( $this->getId() ) |
3598 | 3604 | ); |
3599 | 3605 | return true; |
Index: trunk/phase3/includes/specials/SpecialUserlogin.php |
— | — | @@ -76,6 +76,7 @@ |
77 | 77 | $this->mPassword = $request->getText( 'wpPassword' ); |
78 | 78 | $this->mRetype = $request->getText( 'wpRetype' ); |
79 | 79 | $this->mDomain = $request->getText( 'wpDomain' ); |
| 80 | + $this->mReason = $request->getText( 'wpReason' ); |
80 | 81 | $this->mReturnTo = $request->getVal( 'returnto' ); |
81 | 82 | $this->mReturnToQuery = $request->getVal( 'returntoquery' ); |
82 | 83 | $this->mCookieCheck = $request->getVal( 'wpCookieCheck' ); |
— | — | @@ -162,7 +163,7 @@ |
163 | 164 | $result = $this->mailPasswordInternal( $u, false, 'createaccount-title', 'createaccount-text' ); |
164 | 165 | |
165 | 166 | wfRunHooks( 'AddNewAccount', array( $u, true ) ); |
166 | | - $u->addNewUserLogEntry(); |
| 167 | + $u->addNewUserLogEntry( true, $this->mReason ); |
167 | 168 | |
168 | 169 | $wgOut->setPageTitle( wfMsg( 'accmailtitle' ) ); |
169 | 170 | $wgOut->setRobotPolicy( 'noindex,nofollow' ); |
— | — | @@ -230,7 +231,7 @@ |
231 | 232 | $wgOut->addHTML( wfMsgWikiHtml( 'accountcreatedtext', $u->getName() ) ); |
232 | 233 | $wgOut->returnToMain( false, $self ); |
233 | 234 | wfRunHooks( 'AddNewAccount', array( $u, false ) ); |
234 | | - $u->addNewUserLogEntry(); |
| 235 | + $u->addNewUserLogEntry( false, $this->mReason ); |
235 | 236 | return true; |
236 | 237 | } |
237 | 238 | } |
— | — | @@ -1008,6 +1009,7 @@ |
1009 | 1010 | $template->set( 'email', $this->mEmail ); |
1010 | 1011 | $template->set( 'realname', $this->mRealName ); |
1011 | 1012 | $template->set( 'domain', $this->mDomain ); |
| 1013 | + $template->set( 'reason', $this->mReason ); |
1012 | 1014 | |
1013 | 1015 | $template->set( 'action', $titleObj->getLocalUrl( $q ) ); |
1014 | 1016 | $template->set( 'message', $msg ); |
— | — | @@ -1018,6 +1020,7 @@ |
1019 | 1021 | $template->set( 'emailrequired', $wgEmailConfirmToEdit ); |
1020 | 1022 | $template->set( 'canreset', $wgAuth->allowPasswordChange() ); |
1021 | 1023 | $template->set( 'canremember', ( $wgCookieExpiration > 0 ) ); |
| 1024 | + $template->set( 'usereason', $wgUser->isLoggedIn() ); |
1022 | 1025 | $template->set( 'remember', $wgUser->getOption( 'rememberpassword' ) or $this->mRemember ); |
1023 | 1026 | |
1024 | 1027 | if ( $this->mType == 'signup' ) { |
Index: trunk/phase3/includes/templates/Userlogin.php |
— | — | @@ -243,6 +243,16 @@ |
244 | 244 | </div> |
245 | 245 | </td> |
246 | 246 | <?php } ?> |
| 247 | + <?php if( $this->data['usereason'] ) { ?> |
| 248 | + </tr> |
| 249 | + <tr> |
| 250 | + <td class="mw-label"><label for='wpReason'><?php $this->msg('createaccountreason') ?></label></td> |
| 251 | + <td class="mw-input"> |
| 252 | + <input type='text' class='loginText' name="wpReason" id="wpReason" |
| 253 | + tabindex="7" |
| 254 | + value="<?php $this->text('reason') ?>" size='20' /> |
| 255 | + </td> |
| 256 | + <?php } ?> |
247 | 257 | </tr> |
248 | 258 | <?php if( $this->data['canremember'] ) { ?> |
249 | 259 | <tr> |
— | — | @@ -255,14 +265,14 @@ |
256 | 266 | 'wpRemember', |
257 | 267 | 'wpRemember', |
258 | 268 | $this->data['remember'], |
259 | | - array( 'tabindex' => '7' ) |
| 269 | + array( 'tabindex' => '8' ) |
260 | 270 | ) |
261 | 271 | ?> |
262 | 272 | </td> |
263 | 273 | </tr> |
264 | 274 | <?php } |
265 | 275 | |
266 | | - $tabIndex = 8; |
| 276 | + $tabIndex = 9; |
267 | 277 | if ( isset( $this->data['extraInput'] ) && is_array( $this->data['extraInput'] ) ) { |
268 | 278 | foreach ( $this->data['extraInput'] as $inputItem ) { ?> |
269 | 279 | <tr> |
Index: trunk/phase3/languages/messages/MessagesEn.php |
— | — | @@ -1063,6 +1063,7 @@ |
1064 | 1064 | 'gotaccount' => 'Already have an account? $1.', |
1065 | 1065 | 'gotaccountlink' => 'Log in', |
1066 | 1066 | 'createaccountmail' => 'By e-mail', |
| 1067 | +'createaccountreason' => 'Reason:', |
1067 | 1068 | 'badretype' => 'The passwords you entered do not match.', |
1068 | 1069 | 'userexists' => 'Username entered already in use. |
1069 | 1070 | Please choose a different name.', |
Index: trunk/phase3/RELEASE-NOTES |
— | — | @@ -121,6 +121,7 @@ |
122 | 122 | * Non-file pages can no longer be moved to the file namespace, nor vice versa. |
123 | 123 | * (bug 671) The <dfn> element has been whitelisted in user input. |
124 | 124 | * (bug 24563) Entries on Special:WhatLinksHere now have a link to their history |
| 125 | +* (bug 21503) There's now a "reason" field when creating account for other users |
125 | 126 | |
126 | 127 | === Bug fixes in 1.17 === |
127 | 128 | * (bug 17560) Half-broken deletion moved image files to deletion archive |