Skip to content

Customizing MediaWiki

This article was been published more than a year ago. The information may be outdated.

Mediawiki is a very good CMS, and the one that I have chosen to use for my website, for various reasons. The most readily obvious reason is that it is simple to use and administer, and that I can add content from wherever I might be in the world.
 
However, I don’t want anyone to be able to register as a user, nor to be able to edit or post posts. In addition, I wanted to make a few changes. All the changes are done to one out of two files, either LocalSettings.php or MonoBook.php
 
LocalSettings.php
First off, I changed the page title that shows up

#Setting the page title
$wgSitename = “WGWiki”;

 
Next, I wanted to exchange the default logo for another, that I have made myself.

 

#Defines logo file
$wgLogo = “/wiki/images/wgglider.jpg”;

 
I also wanted to change the favicon, the icon that shows up instead of the Internet Explorer or Mozilla Firefox-logo. 

#Defines favicon
$wgFavicon = “/wiki/images/favicon.ico”;

 

Unlike other wikis, I did not, in choosing MediaWiki, want to open up to access and editing for anyone other than me. 

# This snippet prevents new registrations from anonymous users
# (Sysops can still create user accounts)
$wgGroupPermissions[‘*’][‘createaccount’] = false;

 
I also wanted to block anonymous users by editing the articles. 

# This snippet prevents editing from anonymous users
$wgGroupPermissions[‘*’][‘edit’] = false;

 

MonoBook.php

I also wanted to block anonymous access to the top-side tabs, so that no option to edit, view history etc. would be visible. I achieved this by finding this snippet: 

foreach($this->data[‘content_actions’] as $key => $tab) {

 

to which I added this: 

if($this->data[‘loggedin’]==1)

 

so that it looked like this: 

foreach($this->data[‘content_actions’] as $key => $tab) if($this->data[‘loggedin’]==1) {

 

The result of all of this is we’ve gone from this… 
Wiki before changes
 
…to this: 
Wiki after changes
 
It’s all pretty simple, and it all works.

One Comment

  1. Wireless

    Hello. This post is likeable, and your blog is very interesting, congratulations :-). I will add in my blogroll =). If possible gives a last there on my blog, it is about the Wireless, I hope you enjoy. The address is http://wireless-brasil.blogspot.com. A hug.

By posting a comment, you consent to our collecting the information you enter. See privacy policy for more information.

This site uses Akismet to reduce spam. Learn how your comment data is processed.