From a81a0b18440d6c417a0feab298b4927a03b4c4a9 Mon Sep 17 00:00:00 2001 From: "Mark A. Hershberger" Date: Fri, 30 Sep 2011 20:36:52 +0000 Subject: [PATCH] re r92924 andFix Bug #31283 - "Change E-mail" option in Preference should be hidden when AuthPlugin#allowEmailChange() returns false Patch from Rusty Burchfield --- CREDITS | 1 + includes/Preferences.php | 9 ++++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/CREDITS b/CREDITS index a792447065..444d27ad35 100644 --- 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 diff --git a/includes/Preferences.php b/includes/Preferences.php index a955b6fb5d..69fd1b7d36 100644 --- a/includes/Preferences.php +++ b/includes/Preferences.php @@ -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', ); -- 2.20.1