Index: trunk/extensions/Translate/Translate.php |
— | — | @@ -15,7 +15,7 @@ |
16 | 16 | /** |
17 | 17 | * Version number used in extension credits and in other placed where needed. |
18 | 18 | */ |
19 | | -define( 'TRANSLATE_VERSION', '2011-09-29' ); |
| 19 | +define( 'TRANSLATE_VERSION', '2011-10-07' ); |
20 | 20 | |
21 | 21 | /** |
22 | 22 | * Extension credits properties. |
— | — | @@ -214,6 +214,11 @@ |
215 | 215 | $wgTranslateFuzzyBotName = 'FuzzyBot'; |
216 | 216 | |
217 | 217 | /** |
| 218 | + * Add a preference "Do not send me e-mail newsletters" in the e-mail preferences. |
| 219 | + */ |
| 220 | +$wgTranslateNewsletterPreference = false; |
| 221 | + |
| 222 | +/** |
218 | 223 | * Default values for list of languages to show translators as an aid when |
219 | 224 | * translating. Each user can override this setting in their preferences. |
220 | 225 | * Example: |
Index: trunk/extensions/Translate/README |
— | — | @@ -29,6 +29,10 @@ |
30 | 30 | http://translatewiki.net/docs/Translate/html/ |
31 | 31 | |
32 | 32 | == Change log == |
| 33 | +* 2011-10-07 |
| 34 | +- $wgTranslateNewsletterPreference was introduced (default: false). Setting this |
| 35 | + to true, will once again add the "Do not send me e-mail newsletters" |
| 36 | + preference. |
33 | 37 | * 2011-10-03 |
34 | 38 | - MessageIndex can now be stored in object cache (default) or in a file. |
35 | 39 | - Fixed an error that sometimes prevented translating messages that had |
Index: trunk/extensions/Translate/utils/UserToggles.php |
— | — | @@ -15,31 +15,34 @@ |
16 | 16 | class TranslatePreferences { |
17 | 17 | /** |
18 | 18 | * Add 'translate-pref-nonewsletter' preference. |
19 | | - * This is actually specific to translatewiki.net |
| 19 | + * This is most probably specific to translatewiki.net. Can be enabled |
| 20 | + * with $wgTranslateNewsletterPreference. |
20 | 21 | * |
21 | 22 | * @param $user User |
22 | 23 | * @param $preferences array |
23 | 24 | * @return bool true |
24 | 25 | */ |
25 | 26 | public static function onGetPreferences( $user, &$preferences ) { |
26 | | - global $wgEnableEmail, $wgUser, $wgEnotifRevealEditorAddress; |
| 27 | + global $wgTranslateNewsletterPreference; |
27 | 28 | |
28 | | - // TODO: Shouldn't we use $user here? |
29 | | - // Only show is e-mail is enabled and user has a confirmed e-mail address. |
30 | | - if ( $wgEnableEmail && $wgUser->isEmailConfirmed() ) { |
31 | | - // 'translate-pref-nonewsletter' is used as opt-out for |
32 | | - // users with a confirmed e-mail address |
33 | | - $prefs = array( |
34 | | - 'translate-nonewsletter' => array( |
35 | | - 'type' => 'toggle', |
36 | | - 'section' => 'personal/email', |
37 | | - 'label-message' => 'translate-pref-nonewsletter' |
38 | | - ) |
39 | | - ); |
| 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 | + ); |
40 | 42 | |
41 | | - // Add setting after 'enotifrevealaddr' |
42 | | - $preferences = wfArrayInsertAfter( $preferences, $prefs, |
43 | | - $wgEnotifRevealEditorAddress ? 'enotifrevealaddr' : 'enotifminoredits' ); |
| 43 | + // Add setting after 'enotifrevealaddr' |
| 44 | + $preferences = wfArrayInsertAfter( $preferences, $prefs, |
| 45 | + $wgEnotifRevealEditorAddress ? 'enotifrevealaddr' : 'enotifminoredits' ); |
| 46 | + } |
44 | 47 | } |
45 | 48 | |
46 | 49 | return true; |