re r92924 andFix Bug #31283 - "Change E-mail" option in Preference should be hidden
authorMark A. Hershberger <mah@users.mediawiki.org>
Fri, 30 Sep 2011 20:36:52 +0000 (20:36 +0000)
committerMark A. Hershberger <mah@users.mediawiki.org>
Fri, 30 Sep 2011 20:36:52 +0000 (20:36 +0000)
when AuthPlugin#allowEmailChange() returns false

Patch from Rusty Burchfield

CREDITS
includes/Preferences.php

diff --git a/CREDITS b/CREDITS
index a792447..444d27a 100644 (file)
--- a/CREDITS
+++ b/CREDITS
@@ -147,6 +147,7 @@ following names for their contribution to the product.
 * rgcjonas
 * Robert Treat
 * RockMFR
+* Rusty Burchfield
 * Salvatore Ingala
 * Scott Colcord
 * Simon Walker
index a955b6f..69fd1b7 100644 (file)
@@ -356,12 +356,15 @@ class Preferences {
                                array(),
                                array( 'returnto' => SpecialPage::getTitleFor( 'Preferences' ) ) );
 
+                       $emailAddress = $user->getEmail() ? htmlspecialchars( $user->getEmail() ) : '';
+                       if ( $wgAuth->allowPropChange( 'emailaddress' ) ) {
+                               $emailAddress .= $emailAddress == '' ? $link : " ($link)";
+                       }
+
                        $defaultPreferences['emailaddress'] = array(
                                'type' => 'info',
                                'raw' => true,
-                               'default' => $user->getEmail()
-                                       ? htmlspecialchars( $user->getEmail() ) . " ($link)"
-                                       : $link,
+                               'default' => $emailAddress,
                                'label-message' => 'youremail',
                                'section' => 'personal/email',
                        );