I am creating a custom authentication plugin. The user email is loaded from an external source and it is stored in the mediawiki DB.
The problem is that if a user go to his preferences page, it will have the chance to change his email address.
Looking in specialPreferences.php I have found this:
if ( $wgEnableEmail ) {
$moreEmail = ''; if ($wgEnableUserEmail) { $emf = wfMsg( 'allowemail' ); $disabled = $disableEmailPrefs ? ' disabled="disabled"' : ''; $moreEmail = "<input type='checkbox' $emfc $disabled value='1' name='wpEmailFlag' id='wpEmailFlag' /> <label for='wpEmailFlag'>$emf</label>"; }
$wgOut->addHTML( $this->tableRow( Xml::element( 'h2', null, wfMsg( 'email' ) ) ) . $this->tableRow( $emailauthenticated. $enotifrevealaddr. $enotifwatchlistpages. $enotifusertalkpages. $enotifminoredits. $moreEmail. $this->getToggle( 'ccmeonemails' ) ) ); }
Seems that if I enabled the email with ($wgEnableEmail) the from will print the email form element to change it.
IS there any way for doing what I need (apart modifying brutally the specialPreferences.php?
Thank you
GF wrote :
IS there any way for doing what I need (apart modifying brutally the specialPreferences.php?
I would suggest to add the appropriate Hook (http://www.mediawiki.org/wiki/Hook) in LocalSettings.php.
Someone with more experience with hooks and SpecialPreferences.php might tell you which hook to use.
my guess would be the "InitPreferencesForm" Hook (with something like $foo->mUserEmail = $wgUser->getEmail(); )
fyi, this, added at the end of LocalSettings.php, worked on a local install (1.11) :
$wgHooks['InitPreferencesForm'][] = 'fnMyHook';
function fnMyHook($prefs, $request) { global $wgUser;
$prefs->mUserEmail = $wgUser->getEmail();
return false; }
Alexis Moinet wrote :
GF wrote :
IS there any way for doing what I need (apart modifying brutally the specialPreferences.php?
I would suggest to add the appropriate Hook (http://www.mediawiki.org/wiki/Hook) in LocalSettings.php.
Someone with more experience with hooks and SpecialPreferences.php might tell you which hook to use.
my guess would be the "InitPreferencesForm" Hook (with something like $foo->mUserEmail = $wgUser->getEmail(); )
mediawiki-l@lists.wikimedia.org