Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Wikipedia: Mediawiki

enable email but disable email change.

 

 

Wikipedia mediawiki RSS feed   Index | Next | Previous | View Threaded


ganfab at gmail

May 8, 2008, 5:41 AM

Post #1 of 3 (148 views)
Permalink
enable email but disable email change.

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
_______________________________________________
MediaWiki-l mailing list
MediaWiki-l[at]lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-l


alexis.moinet at fpms

May 8, 2008, 7:21 AM

Post #2 of 3 (139 views)
Permalink
Re: enable email but disable email change. [In reply to]

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 mailing list
MediaWiki-l[at]lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-l


alexis.moinet at fpms

May 9, 2008, 2:13 AM

Post #3 of 3 (131 views)
Permalink
Re: enable email but disable email change. [In reply to]

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 mailing list
MediaWiki-l[at]lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-l

Wikipedia mediawiki RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact lists@gossamer-threads.com
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.