Legoktm has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/100335


Change subject: Link to Special:GlobalPreferences on Special:Preferences
......................................................................

Link to Special:GlobalPreferences on Special:Preferences

Change-Id: I32e0a4910b49b15ff5102d5c2d129e13dd88ab91
---
M GlobalPreferences.hooks.php
M GlobalPreferences.i18n.php
2 files changed, 23 insertions(+), 0 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/GlobalPreferences 
refs/changes/35/100335/1

diff --git a/GlobalPreferences.hooks.php b/GlobalPreferences.hooks.php
index 9892820..d35a43b 100644
--- a/GlobalPreferences.hooks.php
+++ b/GlobalPreferences.hooks.php
@@ -152,6 +152,10 @@
        }
 
        public static function onGetPreferences( User $user, &$prefs ) {
+               if ( !GlobalPreferences::isUserGlobalized( $user ) ) {
+                       return true;
+               }
+
                if ( GlobalPreferences::onGlobalPrefsPage() ) {
                        if ( !isset( $user->mGlobalPrefs ) ) {
                                // Just in case the user hasn't been loaded yet.
@@ -199,7 +203,21 @@
 
                                }
                        }
+               }
 
+               // Provide a link to Special:GlobalPreferences
+               // if we're not on that page.
+               if ( !GlobalPreferences::onGlobalPrefsPage() ) {
+                       $prefs['global-info'] = array(
+                               'type' => 'info',
+                               'section' => 'personal/info',
+                               'label-message' => 'globalprefs-info-label',
+                               'raw' => true,
+                               'default' => Linker::link(
+                                       SpecialPage::getTitleFor( 
'GlobalPreferences' ),
+                                       wfMessage( 'globalprefs-info-link' 
)->escaped()
+                               ),
+                       );
                }
 
                return true;
diff --git a/GlobalPreferences.i18n.php b/GlobalPreferences.i18n.php
index 2924e5f..72e6180 100644
--- a/GlobalPreferences.i18n.php
+++ b/GlobalPreferences.i18n.php
@@ -12,6 +12,8 @@
        'globalprefs-error-header' => 'Error',
        'globalprefs-notglobal' => 'Your account is not a global account and 
cannot set global preferences.',
        'globalpreferences' => 'Global preferences',
+       'globalprefs-info-label' => 'Global preferences:',
+       'globalprefs-info-link' => 'Set your global preferences',
 );
 
 /** Message documentation (Message documentation)
@@ -26,4 +28,7 @@
 {{Identical|error}}',
        'globalprefs-notglobal' => 'Error message a user sees if they don not 
have a global account.',
        'globalpreferences' => '{{doc-special|GlobalPreferences}}',
+       'globalprefs-info-label' => 'Label for link in Special:Preferences to 
go set your global preferences',
+       'globalprefs-info-link' => 'Link text to Special:GlobalPreferences',
+
 );

-- 
To view, visit https://gerrit.wikimedia.org/r/100335
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I32e0a4910b49b15ff5102d5c2d129e13dd88ab91
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/GlobalPreferences
Gerrit-Branch: master
Gerrit-Owner: Legoktm <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to