Manual:Skin configuration

From MediaWiki.org
Jump to: navigation, search

This page contains comprehensive information for administrators on how to configure skins on a wiki. Please refer to Help:Skins for general skin information and Manual:Skinning for developer information on creating new skins.

Set a Default Skin for a Wiki[edit | edit source]

A default skin can be set for new users of a wiki by setting the variable $wgDefaultSkin in LocalSettings.php to the lowercase skin name specified in the skin file. For example:

$wgDefaultSkin = 'vector';

Users can still change their skin later by going to their preferences page. To change all existing users' skin settings, use the userOptions.php maintenance script. The syntax to use on the command line would be:

$ php userOptions.php skin --old <old skin name> --new <new skin name>

Example:

$ php userOptions.php skin --old "monobook" --new "vector"

Suppression of Skins[edit | edit source]

The administrator can limit the skin choices that are offered site-wide in user's preferences by listing skin(s) to suppress in the $wgSkipSkins array. To do this, put something like this in LocalSettings.php:

# To remove various skins from the User Preferences choices
$wgSkipSkins = array("chick", "cologneblue", "nostalgia", "simple", "standard", "monobook");

Site-Wide CSS[edit | edit source]

MediaWiki allows administrators to specify site-wide CSS rules to be added to every page rendered. These rules can be added by editing the page MediaWiki:Common.css. In addition to a global stylesheet, one can also specify CSS rules to be used in certain skins (see Manual:Interface/Stylesheets).

User CSS[edit | edit source]

Users can also specify their own CSS rules by creating the page "User:Username/common.css". The CSS on this page is then applied to whatever skin the user is using. If the website is changed to a different default skin, the user's custom CSS will continue to work just as before. This feature can be enabled by setting $wgAllowUserCss to true in LocalSettings.php. A user can also apply CSS to a specific skin by creating the page "User:Username/skinname.css". If a user uses the monobook skin for example, they would edit the page Special:MyPage/monobook.css.

Remove Skin option from User Preferences[edit | edit source]

The system administrator can completely remove the Skin tab/link so that it does not show up at all in User Preferences. This makes sense if your site will use a customized skin and would not look right in any other skin.

1.16 and newer[edit | edit source]

MediaWiki version: 1.16

Add a new line containing

$wgHiddenPrefs[] = 'skin';

to LocalSettings.php. This will remove the "Skin" tab from preferences and the possibility to use the useskin parameter in the URL.

1.14 and newer[edit | edit source]

MediaWiki version: 1.14

Set $wgAllowUserSkin to false in LocalSettings.php. This will remove the "Skin" tab from preferences and the possibility to use the useskin parameter in the URL.

1.13 and older[edit | edit source]

To remove the Skin link/tab from User Preferences, go in includes/specials/SpecialPreferences.php and comment out (put another # at the beginning of each line or put /* before the first line and */ after the last line) these lines (starts on line ~815, ends on line ~843):

# Skin
#
$wgOut->addHTML( "<fieldset>\n<legend>\n" . wfMsg('skin') . "</legend>\n" );
$mptitle = Title::newMainPage();
$previewtext = wfMsg('skinpreview');
# Only show members of $wgValidSkinNames rather than
# $skinNames (skins is all skin names from Language.php)
foreach ($wgValidSkinNames as $skinkey => $skinname ) {
    if ( in_array( $skinkey, $wgSkipSkins ) ) {
        continue;
    }
    $checked = $skinkey == $this->mSkin ? ' checked="checked"' : '';
    $sn = isset( $skinNames[$skinkey] ) ? $skinNames[$skinkey] : $skinname;
    $mplink = htmlspecialchars($mptitle->getLocalURL("useskin=$skinkey"));
    $previewlink = "<a target='_blank' href=\"$mplink\">$previewtext</a>";
    if( $skinkey == $wgDefaultSkin )
        $sn .= ' (' . wfMsg( 'default' ) . ')';
    $wgOut->addHTML( "<input type='radio' name='wpSkin' id=\"wpSkin$skinkey\" value=\"$skinkey\"$checked /> <label for=\"wpSkin$skinkey\">{$sn}</label> $previewlink<br/>\n" );
}
$wgOut->addHTML( "</fieldset>\n\n" );

It is also possible to just remove all the choices for skins, except for one: see $wgSkipSkin and $wgDefaultSkin.


Language: English  • Deutsch • 日本語