Extension:GlobalPreferences
GlobalPreferences Release status: stable |
|
---|---|
File:GlobalPreferences global selection checkboxes.png | |
Implementation | Special page |
Description | Allows a user to set global (wikifarm-wide) user preferences |
Author(s) | Kunal Mehta, Sam Wilson |
Latest version | 0.1.2 (2018-02-13) |
Compatibility policy | Snapshots releases along with MediaWiki. Master is not backward compatible. |
MediaWiki | 1.25+ |
Database changes | Yes |
Tables | global_preferences |
License | GNU General Public License 2.0 or later |
Download | |
Help | Help:Extension:GlobalPreferences |
Expand | |
Expand | |
Quarterly downloads | Lua error in Module:Extension at line 172: bad argument #1 to 'inNamespace' (unrecognized namespace name 'skin'). |
Public wikis using | Lua error in Module:Extension at line 172: bad argument #1 to 'inNamespace' (unrecognized namespace name 'skin'). |
Translate the GlobalPreferences extension if it is available at translatewiki.net | |
Issues | Open tasks · Report a bug |
The GlobalPreferences extension allows a user to set some or all of their preferences to be used globally on all wikis in a wiki family. For example, you can set your skin to be the same on all wikis, but have different watchlist settings on different wikis. It is also possible for global preferences to be given local exceptions on particular wikis.
Although it is possible to have global user preferences without any extension by setting up a shared database with a shared user_properties table, the GlobalPreferences extension is useful for more varied use cases such as:
- A user wants to set the same language on all wikis, but wants to keep one wiki on its default.
- One wiki has a preference hidden with
$wgHiddenPrefs
, and another doesn't. - A user wants to set a different skin on each wiki.
- Two wikis have two different gadgets named the same.
- A wiki has an extension installed which sets a preference, but that extension is not enabled on another wiki in the farm.
Installation
Before GlobalPreferences can work, you need to set up central user IDs. This can be done with the CentralAuth extension (or other CentralIdLookup provider) but for most wiki families can more easily be done with shared database tables. (This will mean that users' email addresses, passwords, and real names[1] will be set across all wikis, and won't be able to be set on a per-wiki basis.)
If using the shared tables approach, set the following in LocalSettings.php:
$wgSharedDB = '<shared_wiki_database>';
$wgSharedTables = [ 'user' ]; // Note that 'user_properties' is not included.
Then GlobalPreferences can be installed in the usual manner:
- <translate> [[<tvar name=2>Special:ExtensionDistributor/GlobalPreferences</tvar>|Download]] and move the extracted <tvar name=name>
GlobalPreferences
</tvar> folder to your <tvar name=ext>extensions/
</tvar> directory.</translate>
<translate> Developers and code contributors should install the extension [[<tvar name=git>Special:MyLanguage/Download from Git</tvar>|from Git]] instead, using:</translate>cd extensions/
git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/GlobalPreferences - <translate> Add the following code at the bottom of your <tvar name=1>LocalSettings.php </tvar> file:</translate>
wfLoadExtension( 'GlobalPreferences' ); // No need to set $wgGlobalPreferencesDB if it's the same as $wgSharedDB. $wgGlobalPreferencesDB = '<global_preferences_database>';
- <translate> Run the [[<tvar name=update>Special:MyLanguage/Manual:Update.php</tvar>|update script]] which will automatically create the necessary database tables that this extension needs.</translate>
- If you are using a database for
$wgGlobalPreferencesDB
that is not a MediaWiki database (and so won't be updated when you run the update script) then you'll have to install the required database table manually. The SQL required is in thesql/
directory. - File:OOjs UI icon check-constructive.svg <translate> Done</translate> – <translate> Navigate to <tvar name=special>Special:Version</tvar> on your wiki to verify that the extension is successfully installed.</translate>
If you also have the Echo extension installed then GlobalPreferences must be loaded after Echo in LocalSettings.php.
Configuration
$wgGlobalPreferencesDB
- Name of the database to store global preferences in. If no value is given,
$wgSharedDB
will be used, and if that is empty$wgDBname
will be used.
This database does not have to be one that is used for anything else, but often is set to the same as wherever central user data is stored.
Marking a preference as non-globalizable
Non-globalizable preferences are ignored by GlobalPreferences. If you have programmatically defined a preference (via the GetPreferences hook), then you can mark it as non-globalizable by setting the noglobal
property to true
.
API
The extension provides APIs to get and set local and global preferences. They are documented in API subpage.
See also
- Help:Extension:GlobalPreferences
- Manual:Shared database — The easiest way to configure shared user accounts across multiple wikis
- Extension:CentralAuth — Another way to set up global users
- Global preferences page on Meta — Notes about implementing this extension for Wikimedia wikis
- Screenshots of this extension in use
Notes
- ↑ The 'real name' preference is a confusing one because it's handled separately to all other preferences that can be modified from Special:Preferences. See Phabricator:T72670.
File:Wikimedia-logo black.svg | <translate> This {{<tvar name=1>#ifeq:Extension|Extension</tvar>|extension|skin}} is being used on one or more [[<tvar name=2>m:Special:MyLanguage/Wikimedia projects</tvar>|Wikimedia projects]].</translate> <translate> This probably means that the {{<tvar name=1>#ifeq:Extension|Extension</tvar>|extension|skin}} is stable and works well enough to be used by such high-traffic websites.</translate> <translate> Look for this {{<tvar name=1>#ifeq:Extension|Extension</tvar>|extension's|skin's}} name in Wikimedia's <tvar name=2>CommonSettings.php</tvar> and <tvar name=3>InitialiseSettings.php</tvar> configuration files to see where it's installed.</translate> <translate> A full list of the {{<tvar name=1>#ifeq:Extension|Extension</tvar>|extensions|skins}} installed on a particular wiki can be seen on the wiki's <tvar name=ver>Special:Version</tvar> page.</translate> |
GlobalPreferences global selection checkboxes.png |
- Pages with script errors
- Languages pages
- Pages with broken file links
- Stable extensions
- Special page extensions
- Extensions with release branches compatibility policy
- Extensions with manual MediaWiki version
- GPL licensed extensions
- Extensions in Wikimedia version control
- ApiOptions extensions
- BeforePageDisplay extensions
- DeleteUnknownPreferences extensions
- LoadExtensionSchemaUpdates extensions
- LoadUserOptions extensions
- MediaWikiServices extensions
- PreferencesFormPreSave extensions
- SaveUserOptions extensions
- All extensions
- Extensions used on Wikimedia