if (self::$defaultPreferences)
return self::$defaultPreferences;
- global $wgLang, $wgRCMaxAge;
-
+ global $wgRCMaxAge;
+
$defaultPreferences = array();
self::profilePreferences( $user, $defaultPreferences );
self::watchlistPreferences( $user, $defaultPreferences );
self::searchPreferences( $user, $defaultPreferences );
self::miscPreferences( $user, $defaultPreferences );
-
+
wfRunHooks( 'GetPreferences', array( $user, &$defaultPreferences ) );
-
+
## Prod in defaults from the user
global $wgDefaultUserOptions;
foreach( $defaultPreferences as $name => &$info ) {
}
// Actually changeable stuff
- global $wgAllowRealName;
+ global $wgAllowRealName, $wgAuth;
if ($wgAllowRealName) {
$defaultPreferences['realname'] =
array(
- 'type' => 'text',
+ 'type' => $wgAuth->allowRealNameChange() ? 'text' : 'info',
'default' => $user->getRealName(),
'section' => 'personal/info',
'label-message' => 'yourrealname',
'help-message' => 'prefs-help-gender',
);
- global $wgAuth;
if ($wgAuth->allowPasswordChange()) {
global $wgUser; // For skin.
$link = $wgUser->getSkin()->link( SpecialPage::getTitleFor( 'ResetPass' ),
global $wgMaxSigChars;
$defaultPreferences['nickname'] =
array(
- 'type' => 'text',
+ 'type' => $wgAuth->allowNickChange() ? 'text' : 'info',
'maxlength' => $wgMaxSigChars,
'label-message' => 'yournick',
'validation-callback' =>
$defaultPreferences['emailaddress'] =
array(
- 'type' => 'text',
+ 'type' => $wgAuth->allowEmailChange() ? 'text' : 'info',
'default' => $user->getEmail(),
'section' => 'personal/email',
'label-message' => 'youremail',
global $wgEnableEmail, $wgEnableUserEmail, $wgEmailAuthentication;
+ $disableEmailPrefs = false;
+
if ( $wgEmailAuthentication ) {
if ( $user->getEmail() ) {
if( $user->getEmailAuthenticationTimestamp() ) {
wfMsg( 'emailconfirmlink' ) ) . '<br />';
}
} else {
+ $disableEmailPrefs = true;
$emailauthenticated = wfMsg( 'noemailprefs' );
}
'invert' => true,
'section' => 'personal/email',
'label-message' => 'allowemail',
+ 'disabled' => $disableEmailPrefs,
);
$defaultPreferences['ccmeonemails'] =
array(
'type' => 'toggle',
'section' => 'personal/email',
'label-message' => 'tog-ccmeonemails',
+ 'disabled' => $disableEmailPrefs,
);
}
'type' => 'toggle',
'section' => 'personal/email',
'label-message' => 'tog-enotifwatchlistpages',
+ 'disabled' => $disableEmailPrefs,
);
$defaultPreferences['enotifusertalkpages'] =
array(
'type' => 'toggle',
'section' => 'personal/email',
'label-message' => 'tog-enotifusertalkpages',
+ 'disabled' => $disableEmailPrefs,
);
$defaultPreferences['enotifminoredits'] =
array(
'type' => 'toggle',
'section' => 'personal/email',
'label-message' => 'tog-enotifminoredits',
+ 'disabled' => $disableEmailPrefs,
);
$defaultPreferences['enotifrevealaddr'] =
array(
'type' => 'toggle',
'section' => 'personal/email',
- 'label-message' => 'tog-enotifrevealaddr'
+ 'label-message' => 'tog-enotifrevealaddr',
+ 'disabled' => $disableEmailPrefs,
);
}
}
'label-message' => 'contextchars',
'section' => 'searchoptions',
'min' => 0,
- );
+ );
+ global $wgEnableMWSuggest;
+ if ($wgEnableMWSuggest) {
+ $defaultPreferences['disablesuggest'] =
+ array(
+ 'type' => 'toggle',
+ 'label-message' => 'mwsuggest-disable',
+ 'section' => 'searchoptions',
+ );
+ }
// Searchable namespaces back-compat with old format
$searchableNamespaces = SearchEngine::searchableNamespaces();
'section' => 'searchoptions',
'prefix' => 'searchNs',
);
-
- global $wgEnableMWSuggest;
- if ($wgEnableMWSuggest) {
- $defaultPreferences['disablesuggest'] =
- array(
- 'type' => 'toggle',
- 'label-message' => 'mwsuggest-disable',
- 'section' => 'searchoptions',
- );
- }
}
static function miscPreferences( $user, &$defaultPreferences ) {
global $wgAllowUserCss, $wgAllowUserJs;
if( $wgAllowUserCss ) {
$cssPage = Title::makeTitleSafe( NS_USER, $user->getName().'/'.$skinkey.'.css' );
- $customCSS = $sk->makeLinkObj( $cssPage, wfMsgExt('prefs-custom-css', array() ) );
+ $customCSS = $sk->link( $cssPage, wfMsgExt( 'prefs-custom-css', array() ) );
$extraLinks .= " ($customCSS)";
}
if( $wgAllowUserJs ) {
$jsPage = Title::makeTitleSafe( NS_USER, $user->getName().'/'.$skinkey.'.js' );
- $customJS = $sk->makeLinkObj( $jsPage, wfMsgHtml('prefs-custom-js') );
+ $customJS = $sk->link( $jsPage, wfMsgHtml( 'prefs-custom-js' ) );
$extraLinks .= " ($customJS)";
}
if( $skinkey == $wgDefaultSkin )
}
static function validateEmail( $email, $alldata ) {
- global $wgUser; // To check
-
- if ( $email && !$wgUser->isValidEmailAddr( $email ) ) {
+ if ( $email && !User::isValidEmailAddr( $email ) ) {
return wfMsgExt( 'invalidemailaddress', 'parseinline' );
}
$html .= "\n" . $sk->link( $t, wfMsg( 'restoreprefs' ) );
+ $html = Xml::tags( 'div', array( 'class' => 'mw-prefs-buttons' ), $html );
+
return $html;
}