Index: trunk/extensions/Translate/utils/UserToggles.php |
— | — | @@ -25,24 +25,27 @@ |
26 | 26 | public static function onGetPreferences( $user, &$preferences ) { |
27 | 27 | global $wgTranslateNewsletterPreference; |
28 | 28 | |
29 | | - if( $wgTranslateNewsletterPreference === true ) { |
30 | | - global $wgEnableEmail, $wgEnotifRevealEditorAddress; |
31 | | - // Only show is e-mail is enabled and user has a confirmed e-mail address. |
32 | | - if ( $wgEnableEmail && $user->isEmailConfirmed() ) { |
33 | | - // 'translate-pref-nonewsletter' is used as opt-out for |
34 | | - // users with a confirmed e-mail address |
35 | | - $prefs = array( |
36 | | - 'translate-nonewsletter' => array( |
37 | | - 'type' => 'toggle', |
38 | | - 'section' => 'personal/email', |
39 | | - 'label-message' => 'translate-pref-nonewsletter' |
40 | | - ) |
41 | | - ); |
| 29 | + if( !$wgTranslateNewsletterPreference ) { |
| 30 | + return true; |
| 31 | + } |
42 | 32 | |
43 | | - // Add setting after 'enotifrevealaddr' |
44 | | - $preferences = wfArrayInsertAfter( $preferences, $prefs, |
45 | | - $wgEnotifRevealEditorAddress ? 'enotifrevealaddr' : 'enotifminoredits' ); |
46 | | - } |
| 33 | + global $wgEnableEmail, $wgEnotifRevealEditorAddress; |
| 34 | + |
| 35 | + // Only show if e-mail is enabled and user has a confirmed e-mail address. |
| 36 | + if ( $wgEnableEmail && $user->isEmailConfirmed() ) { |
| 37 | + // 'translate-pref-nonewsletter' is used as opt-out for |
| 38 | + // users with a confirmed e-mail address |
| 39 | + $prefs = array( |
| 40 | + 'translate-nonewsletter' => array( |
| 41 | + 'type' => 'toggle', |
| 42 | + 'section' => 'personal/email', |
| 43 | + 'label-message' => 'translate-pref-nonewsletter' |
| 44 | + ) |
| 45 | + ); |
| 46 | + |
| 47 | + // Add setting after 'enotifrevealaddr'. |
| 48 | + $preferences = wfArrayInsertAfter( $preferences, $prefs, |
| 49 | + $wgEnotifRevealEditorAddress ? 'enotifrevealaddr' : 'enotifminoredits' ); |
47 | 50 | } |
48 | 51 | |
49 | 52 | return true; |