Talk:Work Page

From Campaign Labour
Jump to navigation Jump to search

How to redirect users to a particular page after login in MediaWiki[edit]

By default, when a user logs into their account they are redirected back to the same page from which they came (i.e. the page they were viewing when clicking the link for logging in). If you want to, you can select a particular page to which all users will be redirected after they log into their account, no matter from which page they logged in.

To do this, you have to add the variable $wgRedirectOnLogin with the name of the specific page to the LocalSettings.php file of your MediaWiki. For instance, if you add the following on a new line at the end of LocalSettings.php:

$wgRedirectOnLogin = "Main Page"

Remove tabs[edit]

The tabs on mediawiki can be removed by adding the following code to MediaWiki:Common.css.

Code Explanation
#ca-nstab-main { display:none!important; } Page tab
#ca-nstab-user { display:none!important; } User page tab (the Page tab on personal user pages)
#ca-talk { display:none!important; } Discussion tab
#ca-view { display:none!important; } Read tab (from the prepackaged skins this tab is available only in the Vector skin)
#ca-edit { display:none!important; } Edit tab
#ca-history { display:none!important; } View history/History tab
#ca-watch { display:none!important; } the Watch tab for adding the page to the watchlist
#ca-unwatch { display:none!important; } the Unwatch tab for removing the page from the watchlist
#ca-delete { display:none!important; } Delete tab (in the Vector skins it's displayed with the More drop-down menu)
#ca-move { display:none!important; } Move tab (in the Vector skin it's part of the More drop-down menu)
#ca-protect { display:none!important; } Protect tab (as the previous two, with the Vector skin it's in the More drop-down menu)
#ca-viewsource { display:none!important; } View source tab; this tab is available for users who belong to user groups that don't have the permission to edit pages. With it the user can view the source text of the page without being able to modify it.

Remove Tabs from Specific Pages[edit]

It is possible to remove a tab only from a particular page(s) of your choice. For example, the following: li#ca-delete { display:none!important; }

will hide the Delete tab on the Main Page.

You only have to replace the ID of the tab and the name of the page. In the above example the ID of the tab is #ca-delete and the name of the page Main_Page.

So, for example, if you want to remove the Discussion tab on a page with the name "Example Page", use this code: li#ca-talk { display:none!important; }

If the name of the page consists of more than one word, put underscores (_) between the words.

Lines between tabs[edit]

In the Vector skin, the light blue fading lines between tabs is called the div.vectorTabs span The light blue fading lines on the sides are left-navigation and right-navigation.

See this help page topic for more information

To hide sidebar[edit]

/** Hide sidebar **/ div#mw-panel { display: none; } #left-navigation { left: 1em; } #mw-head-base, div#content, div#footer { margin-left: 1em; }

Change font size on sidebar[edit]

div#mw-panel div.portal h3, div#mw-panel div.portal div.body ul li { font-size: 1.0em; /* default is 0.75em */ }

Remove Tools from SideBar[edit]

#p-tb{ display : none; }

Remove Administration from Sidebar[edit]

Not needed generally as doesn't display for none-admins

#p-Administration-label{ display : none; }

Group Sidebar[edit]

"MediaWiki:Sidebar-groupname" whereas groupname is something like "sysop" or "user".

Sidebar width in Vector skin (CSS)[edit]

You can change the width of your sidebar by adding the following CSS rules to your MediaWiki:Vector.css. The standard width in vector skin is 10em. The following example changes the width to 12em:

/* increase Vector sidebar width */ div#mw-panel { width: 12em; } div#footer, #mw-head-base, div#content { margin-left: 12em; }

  1. left-navigation { margin-left: 12em; }

Request for training material Wiki[edit]

To install Extension:GetUserName[edit]


When {{#USERNAME:}} is found in the page, it will replace it with the current user name. I wrote this because I wanted to make a link where the users could create draft documents easily, with unique names, in their user namespace. I added this to my page:

Note: Must turn off Cache for the page it is being used on! This could be a problem as I'll be using it on every page practically. I will look at writing a global variable using LUA and see if that is better!


   Copy the code into a file named "GetUserName.php" and place the file(s) in a directory called GetUserName in your extensions/ folder.
   Add the following code at the bottom of your LocalSettings.php:
   require_once "$IP/extensions/GetUserName/GetUserName.php";
   Yes Done – Navigate to Special:Version on your wiki to verify that the extension is successfully installed.



<?php if ( !defined( 'MEDIAWIKI' ) ) {

   die( 'This file is a MediaWiki extension and not a valid entry point' );


$wgExtensionCredits['parserhook'][] = array(

   'path' => __FILE__,
   'name' => 'GetUserName',
   'version' => '1.0',
   'url' => '',
   'author' => 'Ejcaputo',
   'description' => "Allows the current user's name to be put in a page"


$wgHooks[ 'ParserFirstCallInit' ][] = "ExtGetUserName::setup"; $wgHooks[ 'LanguageGetMagic' ][] = 'ExtGetUserName::languageGetMagic';

class ExtGetUserName {

   private static $parserFunctions = array(
       'USERNAME' => 'getUserName',

   public static function setup( &$parser ) {
       // register each hook
       foreach( self::$parserFunctions as $hook => $function )
           $parser->setFunctionHook( $hook,
               array( __CLASS__, $function ), SFH_OBJECT_ARGS );

       return true;

   public static function languageGetMagic( &$magicWords, $langCode ) {
       $magicWords[ 'USERNAME' ] = array( 0, 'USERNAME' ); 
       return true;

   public static function getUserName( &$parser, $frame, $args ) {

global $wgUser;

       return trim( $wgUser->getName() );


Turn off Search Box[edit] h1.firstHeading, #p-search { display: none; }

Change header settings and hide sidebar (note: all pages)[edit]

#top-wrap { background-image: url(images/e/e8/ArduinoPedia_Banner.jpg); /* */ font-size: 24px; color: #fff; text-shadow: 2px 0 0 #000, 0 -2px 0 #000, 0 2px 0 #000, -2px 0 0 #000; } /* change uppercase to none - title not transformed to uppercase */ h1 { text-transform: none; } /* changing header - title */ #top-wrap h1 { text-decoration: none; font-size: 3em; line-height: 1.3; }

Hide Sidebar[edit]

/* hide sidemenu to non-logged users */ #menu { display: none !important; }