How to redirect users to a particular page after login in MediaWiki

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

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

It is possible to remove a tab only from a particular page(s) of your choice. For example, the following:

body.page-Main_Page 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:

body.page-Example_Page 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

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

/** 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

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

#p-tb{ display : none; }

Remove Administration from Sidebar

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

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


Group Sidebar

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


Sidebar width in Vector skin (CSS)

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

https://meta.miraheze.org/wiki/Special:RequestWikiQueue/7389

To install Extension:GetUserName

Usage

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!

Installation

   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.

Code

GetUserName.php

<?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' => 'https://www.mediawiki.org/wiki/Extension:GetUserName',
   '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 ) {
       $parser->disableCache();

global $wgUser;

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

}


Turn off Search Box

body.page-Main_Page.action-view h1.firstHeading, #p-search { display: none; }

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

#top-wrap { background-image: url(images/e/e8/ArduinoPedia_Banner.jpg); /* http://stackoverflow.com/questions/4772906/css-is-it-possible-to-add-a-black-outline-around-each-character-in-text */ 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

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