Manual:Interface/Sidebar/Hacks

This page lists hacks that used to be mentioned in Manual:Interface/Sidebar.

Change sidebar content when logged in (PHP)
In your LocalSettings.php file, use the SkinBuildSidebar hook to modify the sidebar. Use the following 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.

Allow wiki markup
Many people on Support Desk have been asking about how to put arbitrary wikitext into the sidebar. Take the code from the above example. The text function will return your page content unescaped, only {{-transformation is done. Instead of using the text function, you can use the parse function. Your page content will then be fully parsed from wikitext to HTML. Instead of

use this:

That will allow your sidebar article to be proper wikitext.

Content of MediaWiki:Sidebar
In your sidebar, you will need to include the surrounding HTML tags to ensure the portlet is styled correctly. Your MediaWiki:Anon Sidebar page content will need to look something like the following example after the change: