Well, it's been a while since I've blogged on here, due to getting snowed
under with coding, but I've now got something you might find useful.
If you run a user interactive site, you might well use
phpbb as your bulletin board software,
and MediaWiki for your user generated
documentation. (Well, at least I've run a site or two doing this).
There's already a nice extension
here that allows MediaWiki to use phpBB login credentials, so you don't
have to keep shuffling two sets of users around, but I thought it would be
nice to go one further and use the actual phpBB API. This is the result.
This extension requires PHP5.2, MediaWiki 1.11+ and phpBB3. To get this working,
you'll need to do the following:
- Because MediaWiki and PHPBB both make prominent use of a class called 'user',
and because PHP 5.2 doesn't provide a nice way of using
include or require and yanking the whole lot into
a separate namespace, you'll have to modify one codebase or the other to
avoid conflicing class names. I recommend changing phpBB, and renaming
user to phpbbuser. You will need to change the
class definition and constructor in includes/session.php and
the single instantiation point in common.php.
- Download the source here, unpack it and put it in the
extensions
subdirectory where you've installed MediaWiki.
- Add the following code to the bottom of
LocalSettings.php:
require_once './extensions/Auth_xphpBB.php';
$wgAuth_Config = array();
// Name of your PHPBB group
// users need to be a member
// of to use the wiki. (i.e. wiki)
// This can also be set to an array
// of group names to use more then
// one. (ie.
// $wgAuth_Config['WikiGroupName'][] = 'Wiki';
// $wgAuth_Config['WikiGroupName'][] = 'Wiki2';
// or
// $wgAuth_Config['WikiGroupName'] = array('Wiki', 'Wiki2');
// )
$wgAuth_Config['WikiGroupName'] = 'Wiki';
// This tells the Plugin to require
// a user to be a member of the above
// phpBB group. (ie. wiki) Setting
// this to false will let any phpBB
// user edit the wiki.
$wgAuth_Config['UseWikiGroup'] = true;
// Path from this file to your phpBB install.
$wgAuth_Config['PathToPHPBB'] = '../phpbb3/';
// Localize the messages
$wgAuth_Config['LoginMessage'] =
'You need a phpBB account to login.';
$wgAuth_Config['NoWikiError'] =
'You are not a member of the required phpBB group.';
$wgAuth = new Auth_phpBB($wgAuth_Config);
These settings should be familiar if you've used the Auth_phpBB.php extension,
though you'll notice there are a lot less options.
Any thoughts, comments, praise to the skies or flamewars, do let me know!