On the SammyWiki site I use both vBulletin and Mediawiki. The two packages have been setup so that there is a single sign on using the vBulletin authentication system.
This works very well but users can only login via vBulletin, the Mediawiki login page becomes redundant. Although it is possible to switch off user registration in Mediawiki, I couldn’t find a way to prevent people from trying to login through the Special:UserLogin page.
I considered two solutions:
- Remove the login link. However this link becomes logout and that still works. Also without the login link users might not know how to get access to the site!
- Remove the login username/password boxes. This way I could still have the login page, which would have links to the vBulletin login and registration pages, but users would no longer try to get access through MediaWiki.
Creating a MediaWiki Extention to Edit the SpecialUserLogin page
MediaWiki extensions are brand new to me so this was my first ever attempt. Fortunately the developers have provided us with a whole range of hooks that allow us to modify almost anything!
Here is the basic test extention that I created:
$wgHooks['UserLoginForm'] = ‘onUserLoginForm’;
$template->set( ‘name’, ‘!’ );
$template->set( ‘password’, ‘?’ );
$template->data['message'] = ‘JEZTEST’;
$template->data['messagetype'] = ‘error’;
And to get this to run, call it from within LocalSettings.php:
Editing the LoginForm Template
Although my basic extention worked, I couldn’t see how to make changes to the actual form template. If anyone knows how to do this, please let me know!
So plan b was to edit the template directly and remove the login boxes.
This solution isn’t quite so good as I will need to replicate the change anytime I upload and overwrite the template with a new version of MediaWiki, but it will do the job for now.
The file to edit is:
You’ll see where the name and password boxes are generated by searching for “Html::input”
Editing the MediaWiki Login Page Text Message
Pretty much any message in your MediaWiki installation can be edited, and the text displayed on the user login special page is no exception.
Generally, to make any edits to messages, go to Special Pages->System Messages
This should take you to the wiki/Special:AllMessages page. Here you need to search for and locate the “loginprompt” message. Note that you need to have the correct user rights to edit this.