mediawiki with drupal authentication

In the past few years I've set up and used MediaWikis for various open source related activities, for instance 2008 and Linux Users of Victoria. Both of these would be prime targets for wikispam if anyone could anonymously edit pages on them, so edit privileges are limited to registered users only.

Normally a wiki would allow anyone to create an account, but because LCA has a registration system and LUV has an existing website with user info, there is existing authentication information we could use to limit access to these wikis.

Luckily MediaWiki allows you to use external authentication providers. It comes with the skeleton file  include/AuthPlugin.php, which you can modify, rename and then use. For LUV, I hacked it up a bit so it can be used as a generic Drupal one; AuthPluginDrupal.php.

If you want to use it, download it and save it to the extensions directory in your MediaWiki installation. You'll need to change the MySQL authentication settings at the top of the class definition, so that it can access your Drupal users table.

Next, tell your wiki to use it by adding it to LocalSettings.php:

$wgAuth = new AuthPluginDrupal();

Now any active Drupal user can login to your wiki.  The email address that's set in Drupal is automatically transposed, so even the wiki mail functions work fine.

Plain text icon AuthPluginDrupal.php.txt7.96 KB


Thank you for posting this extension. I needed to do a Mediawiki -> Drupal integration, and this saved me a LOT of time. Nicely done!