Manual:Interface/Sidebar/Hacks

This page lists hacks that used to be mentioned in Manual:Interface/Sidebar. These have been removed because they involve modifying the core .php code and are not supported. They are only here for historical interest.

Change sidebar content when logged in (PHP)
To get anonymous users to have their own sidebars change includes/Skin.php. There is a function called buildSidebar. Edit this function to check for $wgUser->isLoggedIn and call a different system message than sidebar.

Then in your Wiki, go to MediaWiki:anon_sidebar and create your new sidebar. You may need to add $wgUser to the list of global variables in the buildSidebar.

You'll also have to add $wgUser in the globals declaration of the function.

Allow wiki markup (PHP)
Many people on support desk have been asking about how to put arbitrary wikitext into the side bar. You can hack your skins/Monobook.php file (if you're using monobook) and replace the following section of code.

MediaWiki < 1.13.2
Replace this: with this...

If php4 on your sys

MediaWiki 1.13.2
Replace this: with this:

Content of MediaWiki:Sidebar
That will allow the MediaWiki:Sidebar article to be proper wikitext. You will need to include the 'pBody' div tag to ensure the portlet is styled correctly, so your MediaWiki:Sidebar article will need to look something like the following example after the change: Navigation
 * Main Page
 * Community portal
 * [ Recent changes]
 * Sandbox
 * Help

Add a banner to the sidebar (PHP)
You can add one or more banners to the sidebar by hacking your skins/Monobook.php file (if you're using monobook) to include the following piece of code. (This works great on Monobook but is there an equivalent for Vector?)

Find (line 188):

Include:

Now in your Wiki, create four System messages: (i.e. articles named MediaWiki:sidebar-banner1-...)

To add more banners, just repeat the process renaming "banner1" to "banner2" etc.