r70272 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r70271‎ | r70272 | r70273 >
Date:10:42, 1 August 2010
Author:ialex
Status:ok (Comments)
Tags:
Comment:
* (bug 21503) There's now a "reason" field when creating account for other users
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/User.php (modified) (history)
  • /trunk/phase3/includes/specials/SpecialUserlogin.php (modified) (history)
  • /trunk/phase3/includes/templates/Userlogin.php (modified) (history)
  • /trunk/phase3/languages/messages/MessagesEn.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/User.php
@@ -3571,28 +3571,34 @@
35723572
35733573 /**
35743574 * Add a newuser log entry for this user
 3575+ *
35753576 * @param $byEmail Boolean: account made by email?
 3577+ * @param $reason String: user supplied reason
35763578 */
3577 - public function addNewUserLogEntry( $byEmail = false ) {
3578 - global $wgUser, $wgNewUserLog;
 3579+ public function addNewUserLogEntry( $byEmail = false, $reason = '' ) {
 3580+ global $wgUser, $wgContLang, $wgNewUserLog;
35793581 if( empty( $wgNewUserLog ) ) {
35803582 return true; // disabled
35813583 }
35823584
35833585 if( $this->getName() == $wgUser->getName() ) {
35843586 $action = 'create';
3585 - $message = '';
35863587 } else {
35873588 $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+ }
35913597 }
35923598 $log = new LogPage( 'newusers' );
35933599 $log->addEntry(
35943600 $action,
35953601 $this->getUserPage(),
3596 - $message,
 3602+ $reason,
35973603 array( $this->getId() )
35983604 );
35993605 return true;
Index: trunk/phase3/includes/specials/SpecialUserlogin.php
@@ -76,6 +76,7 @@
7777 $this->mPassword = $request->getText( 'wpPassword' );
7878 $this->mRetype = $request->getText( 'wpRetype' );
7979 $this->mDomain = $request->getText( 'wpDomain' );
 80+ $this->mReason = $request->getText( 'wpReason' );
8081 $this->mReturnTo = $request->getVal( 'returnto' );
8182 $this->mReturnToQuery = $request->getVal( 'returntoquery' );
8283 $this->mCookieCheck = $request->getVal( 'wpCookieCheck' );
@@ -162,7 +163,7 @@
163164 $result = $this->mailPasswordInternal( $u, false, 'createaccount-title', 'createaccount-text' );
164165
165166 wfRunHooks( 'AddNewAccount', array( $u, true ) );
166 - $u->addNewUserLogEntry();
 167+ $u->addNewUserLogEntry( true, $this->mReason );
167168
168169 $wgOut->setPageTitle( wfMsg( 'accmailtitle' ) );
169170 $wgOut->setRobotPolicy( 'noindex,nofollow' );
@@ -230,7 +231,7 @@
231232 $wgOut->addHTML( wfMsgWikiHtml( 'accountcreatedtext', $u->getName() ) );
232233 $wgOut->returnToMain( false, $self );
233234 wfRunHooks( 'AddNewAccount', array( $u, false ) );
234 - $u->addNewUserLogEntry();
 235+ $u->addNewUserLogEntry( false, $this->mReason );
235236 return true;
236237 }
237238 }
@@ -1008,6 +1009,7 @@
10091010 $template->set( 'email', $this->mEmail );
10101011 $template->set( 'realname', $this->mRealName );
10111012 $template->set( 'domain', $this->mDomain );
 1013+ $template->set( 'reason', $this->mReason );
10121014
10131015 $template->set( 'action', $titleObj->getLocalUrl( $q ) );
10141016 $template->set( 'message', $msg );
@@ -1018,6 +1020,7 @@
10191021 $template->set( 'emailrequired', $wgEmailConfirmToEdit );
10201022 $template->set( 'canreset', $wgAuth->allowPasswordChange() );
10211023 $template->set( 'canremember', ( $wgCookieExpiration > 0 ) );
 1024+ $template->set( 'usereason', $wgUser->isLoggedIn() );
10221025 $template->set( 'remember', $wgUser->getOption( 'rememberpassword' ) or $this->mRemember );
10231026
10241027 if ( $this->mType == 'signup' ) {
Index: trunk/phase3/includes/templates/Userlogin.php
@@ -243,6 +243,16 @@
244244 </div>
245245 </td>
246246 <?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 } ?>
247257 </tr>
248258 <?php if( $this->data['canremember'] ) { ?>
249259 <tr>
@@ -255,14 +265,14 @@
256266 'wpRemember',
257267 'wpRemember',
258268 $this->data['remember'],
259 - array( 'tabindex' => '7' )
 269+ array( 'tabindex' => '8' )
260270 )
261271 ?>
262272 </td>
263273 </tr>
264274 <?php }
265275
266 - $tabIndex = 8;
 276+ $tabIndex = 9;
267277 if ( isset( $this->data['extraInput'] ) && is_array( $this->data['extraInput'] ) ) {
268278 foreach ( $this->data['extraInput'] as $inputItem ) { ?>
269279 <tr>
Index: trunk/phase3/languages/messages/MessagesEn.php
@@ -1063,6 +1063,7 @@
10641064 'gotaccount' => 'Already have an account? $1.',
10651065 'gotaccountlink' => 'Log in',
10661066 'createaccountmail' => 'By e-mail',
 1067+'createaccountreason' => 'Reason:',
10671068 'badretype' => 'The passwords you entered do not match.',
10681069 'userexists' => 'Username entered already in use.
10691070 Please choose a different name.',
Index: trunk/phase3/RELEASE-NOTES
@@ -121,6 +121,7 @@
122122 * Non-file pages can no longer be moved to the file namespace, nor vice versa.
123123 * (bug 671) The <dfn> element has been whitelisted in user input.
124124 * (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
125126
126127 === Bug fixes in 1.17 ===
127128 * (bug 17560) Half-broken deletion moved image files to deletion archive

Comments

#Comment by Jorm (WMF) (talk | contribs)   22:25, 7 September 2011

The "reason" field has got to be removed.

#Comment by Catrope (talk | contribs)   22:26, 7 September 2011

Would you care to elaborate?

#Comment by Jorm (WMF) (talk | contribs)   23:07, 7 September 2011

You know, I totally misunderstood this as I saw it. Plus, I had another extension running which hooked over seeing this in the situation it was running in.

I do think that the entire "create an account for someone" flow needs reworking but I'm going to withdraw objection here; my bad; nothing to see here; carry on; these are not the droids you're looking for.

#Comment by P858snake (talk | contribs)   22:31, 7 September 2011

I see no reason it "has" to be removed, In fact I can think of heaps of ways it will be useful in the wikis I run at least and possibly for the WMF run wikis as well.

Recommending un-FIXME unless a compelling reason is given, since there is nothing wrong atm.

#Comment by MZMcBride (talk | contribs)   23:13, 7 September 2011

Interestingly, Brandon's comment made me look at this a bit more closely. wikimediafoundation.org (a fishbowl wiki) uses the field occasionally, as can be seen from the database:

mysql> select log_comment from logging where log_type = 'newusers' order by log_timestamp desc limit 50;
+----------------------------------------------------------------------------------------------------------------------+
| log_comment                                                                                                          |
+----------------------------------------------------------------------------------------------------------------------+
| password sent by e-mail                                                                                              |
| password sent by e-mail                                                                                              |
| password sent by e-mail                                                                                              |
| password sent by e-mail                                                                                              |
| password sent by e-mail                                                                                              |
| password sent by e-mail                                                                                              |
| password sent by e-mail                                                                                              |
| password sent by e-mail                                                                                              |
| password sent by e-mail                                                                                              |
| password sent by e-mail                                                                                              |
| password sent by e-mail                                                                                              |
| password sent by e-mail                                                                                              |
| Office IT / WMF, password sent by e-mail                                                                             |
| password sent by e-mail                                                                                              |
| password sent by e-mail                                                                                              |
| password sent by e-mail                                                                                              |
| password sent by e-mail                                                                                              |
| password sent by e-mail                                                                                              |
| password sent by e-mail                                                                                              |
| Storyteller, password sent by e-mail                                                                                 |
| password sent by e-mail                                                                                              |
| password sent by e-mail                                                                                              |
| Fundraiser, password sent by e-mail                                                                                  |
| password sent by e-mail                                                                                              |
| password sent by e-mail                                                                                              |
| password sent by e-mail                                                                                              |
| Advisory Board; requested: [http://meta.wikimedia.org/?oldid=2681482#User:Jessamyn, http://meta.wikimedia.org/?oldid=2681482#User:Jessamyn,] password sent by e-mail           |
| password sent by e-mail                                                                                              |
| Wikimedia Canada; requested: [http://meta.wikimedia.org/?oldid=2638991#User:Jmh649, http://meta.wikimedia.org/?oldid=2638991#User:Jmh649,] password sent by e-mail           |
| password sent by e-mail                                                                                              |
| password sent by e-mail                                                                                              |
| New Community Staff, password sent by e-mail                                                                         |
| by request from OIT, password sent by e-mail                                                                         |
| password sent by e-mail                                                                                              |
| Board member of a chapter with need, password sent by e-mail                                                         |
| password sent by e-mail                                                                                              |
| password sent by e-mail                                                                                              |
| password sent by e-mail                                                                                              |
| Office volunteer; needs access, password sent by e-mail                                                              |
| staff with need, password sent by e-mail                                                                             |
| password sent by e-mail                                                                                              |
| password sent by e-mail                                                                                              |
| password sent by e-mail                                                                                              |
| Contractor/trusted Wikimedian; request: [http://meta.wikimedia.org/?oldid=2458608#User:Reedy, http://meta.wikimedia.org/?oldid=2458608#User:Reedy,] password sent by e-mail |
| Staff, password sent by e-mail                                                                                       |
| Foundation staff, password sent by e-mail                                                                            |
| WMF Staff, password sent by e-mail                                                                                   |
| Tony Le, password sent by e-mail                                                                                     |
|                                                                                                                      |
|                                                                                                                      |
+----------------------------------------------------------------------------------------------------------------------+
50 rows in set (0.00 sec)

However, the comments don't seem to appear at <http://wikimediafoundation.org/wiki/Special:Log/newusers> or <http://wikimediafoundation.org/wiki/Special:Log>. A bit bizarre.

Status & tagging log