r43274 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r43273‎ | r43274 | r43275 >
Date:11:22, 7 November 2008
Author:btongminh
Status:old
Tags:
Comment:
* Add a don't send mail checkbox
* Fix some issues with properties not updating
Modified paths:
  • /trunk/extensions/NssMySQLAuth/NssMySQLAuth.i18n.php (modified) (history)
  • /trunk/extensions/NssMySQLAuth/SpecialAccountManager.php (modified) (history)

Diff [purge]

Index: trunk/extensions/NssMySQLAuth/NssMySQLAuth.i18n.php
@@ -22,6 +22,7 @@
2323 'nss-save-changes' => 'Save changes',
2424 'nss-create-account-header' => 'Create new account',
2525 'nss-create-account' => 'Create account',
 26+ 'nss-no-mail' => 'Do not send email',
2627 'nss-welcome-mail' => 'An account with username $1 and password $2 has been created for you.',
2728 'nss-welcome-mail-subject' => 'Account creation',
2829
Index: trunk/extensions/NssMySQLAuth/SpecialAccountManager.php
@@ -125,6 +125,8 @@
126126 $wgOut->addHTML( "</table>\n" );
127127 $wgOut->addHTML( "<div id=\"newaccount-submit\">\n".
128128 Xml::hidden( 'action', 'create' ).
 129+ Xml::checkLabel( wfMsg( 'nss-no-mail' ), 'nss-no-mail', 'nss-no-mail' ).
 130+ "<br />\n".
129131 Xml::element( 'input', array(
130132 'type' => 'submit',
131133 'value' => wfMsg( 'nss-create-account' )
@@ -152,7 +154,8 @@
153155 if( !isset( $this->users[$username] ) )
154156 continue;
155157
156 - if( !in_array( $keyname, $wgUserProperties ) )
 158+ if( !in_array( $keyname, $wgUserProperties ) &&
 159+ !in_array( $keyname, array( 'email', 'active' )) )
157160 continue;
158161
159162 $this->users[$username]->set( $keyname, $value );
@@ -198,6 +201,9 @@
199202 }
200203 $this->users[$userprops->getName()] = $userprops;
201204
 205+ if ( $wgRequest->getCheck( 'nss-no-mail' ) )
 206+ return true;
 207+
202208 global $wgPasswordSender;
203209 $email = wfMsg( 'nss-welcome-mail', $username, $password );
204210 $mailSubject = wfMsg( 'nss-welcome-mail-subject' );
@@ -252,7 +258,9 @@
253259 $this->username = $username;
254260 $this->props = array();
255261 $this->email = $email;
 262+ $this->setInternal( 'email', $email );
256263 $this->active = $active;
 264+ $this->setInternal( 'active', $active );
257265 }
258266 function getProps() {
259267 return $this->props;
@@ -298,6 +306,10 @@
299307 $this->old_props = array();
300308 }
301309 $this->old_props[$name] = $this->props[$name] = $value;
 310+ if( $name == 'active' )
 311+ $this->active = $value;
 312+ if( $name == 'email' )
 313+ $this->email = $value;
302314 }
303315
304316 function update() {
@@ -314,7 +326,7 @@
315327 if ( isset( $diff['active'] ) ) $this->active = $diff['active'];
316328 $dbw->update( 'passwd',
317329 array( 'pwd_email' => $this->email, 'pwd_active' => $this->active ),
318 - array( 'pwd_user' => $this->username ),
 330+ array( 'pwd_name' => $this->username ),
319331 __METHOD__
320332 );
321333 // Put it into user_props as well for history

Status & tagging log