Extension:PHPBB Auth

This extension links MediaWiki to phpBB's user table for authentication, and disallows the creation of new accounts in MediaWiki. Users must then log in to the wiki with their phpBB account.

Extension
The extension requires PHP 4.x, MySQL 4.x, and MediaWiki 1.9.x If you need help, log in at uber.leetphp.com and select 'Support' on the main menu.


 * 1) Download the extension (download, view source code).
 * 2) Add the code below to the bottom of LocalSettings.php.
 * 3) Make a new phpBB group called "wiki". If you set   to true, only users in the wiki group can edit MediaWiki.

// This requires a user be logged into the wiki to make changes. $wgGroupPermissions['*']['edit'] = false;

// Specify who may create new accounts. $wgGroupPermissions['*']['createaccount'] = false;

// PHPBB User Database Plugin. (Requires MySQL Database) require_once 'extensions/Auth_phpbb.php';

$GLOBALS['wgPHPBB_WikiGroupName'] = 'wiki';    // Name of your PHPBB group // users need to be a member // of to use the wiki. (i.e. wiki)

$GLOBALS['wgPHPBB_UseWikiGroup']   = true;     // 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.

$GLOBALS['wgPHPBB_UseExtDatabase'] = false;    // This tells the plugin that the phpBB tables // are in a different database then the wiki. // The default settings is false.

/*-[NOTE: You only need the next four settings if you set $wgPHPBB_UseExtDatabase to true.]-*/ //$GLOBALS['wgPHPBB_MySQL_Host']    = 'host';               // phpBB MySQL Host Name. //$GLOBALS['wgPHPBB_MySQL_Username'] = 'username';          // phpBB MySQL Username. //$GLOBALS['wgPHPBB_MySQL_Password'] = 'password';          // phpBB MySQL Password. //$GLOBALS['wgPHPBB_MySQL_Database'] = 'database_name';     // phpBB MySQL Database Name.

$GLOBALS['wgPHPBB_UserTB']          = 'phpbb_users';        // Name of your PHPBB user table. (i.e. phpbb_users) $GLOBALS['wgPHPBB_GroupsTB']        = 'phpbb_groups';       // Name of your PHPBB groups table. (i.e. phpbb_groups) $GLOBALS['wgPHPBB_User_GroupTB']    = 'phpbb_user_group';   // Name of your PHPBB user_group table. (i.e. phpbb_user_group) $wgAuth                             = new Auth_PHPBB;     // Auth_PHPBB Plugin.

Single-session login with phpBB 2
This extra functionality lets MediaWiki share a session with phpBB, which means that a user needs to log in only once. This method only works for PHPBB 2.*. Users will use mediawiki to login, disable the phpbb login page. The author is mconnors (morguefile.com)

Logout
Place this code in includes/SpecialUserLogout.php.

function wfSpecialUserlogout { global $wgUser, $wgOut, $returnto, $userdata; $userdata = session_pagestart($user_ip, PAGE_LOGIN); init_userprefs($userdata); if (wfRunHooks('UserLogout', array(&$wgUser))) { $wgUser->logout;

wfRunHooks('UserLogoutComplete', array(&$wgUser)); $wgOut->mCookies = array; $wgOut->setRobotpolicy( 'noindex,nofollow' ); $wgOut->addHTML( wfMsg( 'logouttext' ) ); $wgOut->returnToMain; session_end($userdata['session_id'], $userdata['user_id']); } }

Login and logout with phpBB 3 (RC 1)
If you want to login to phpBB 3 on your form and logout from eg. the Mediawiki, you should follow the description. Author: szotsaki. Please, if you spotted an error, or you if you improved this, email me: [mailto:szotsaki@gmail.com szotsaki@gmail.com]. Thanks :)

Separate Domains
Synchronous-Login/Logout does not work if your Wiki and phpBB don't share the same domain name (even sub-domains).

For example, if your wiki resides on wiki.domain.com and your phpBB resides on forums.domain.com, the Login and Logout sections won't work as expected.

Usernames rules
MediaWiki does not follow the same user naming conventions as phpBB, so there may be problem if someone uses an invalid username. Although all MediaWiki usernames are valid in phpBB, some phpBB usernames are not valid in MediaWiki. For example, MediaWiki does not allow the '[]' bracket symbols.

The problem can be circumvented by installing a phpBB extension to restrict MediaWiki-incompatible characters in phpBB. The Restrict Username mod (beta) can do this.

Problems with not sharing a database
Some users experience an error when phpBB and MediaWiki are in different databases, while other users have no problem doing so. It's possible that this may be related to non-English software, which is common to users reporting the error. For more information, see the uber|leet.php forums.

Change log

 * Release 2.6
 * Fixed a login bug where MW was displaying an error the first time a user logged into it.
 * Now works with MW 9.2


 * Release 2.5
 * I made a change to the MySQL connection that might fix some of the issues people have been having.


 * Release 2.4
 * Better MySQL error reporting. More solid MySQL Query calls.


 * Release 2.3
 * phpBB usernames with an apostrophe in them will now work.


 * Release 2.2
 * Fixed a bug that was printing a SQL statment when called.


 * Release 2.1
 * Fixed a bug that was not letting preferences be saved.


 * Release 2.0
 * Works with MediaWiki 1.5.x
 * Fixed the dup name issues. The 1.5 release of MediaWiki added a new function to check for the correct casing of a name before adding it to the wiki database.
 * I test user names with a space in them and they seem to work fine too.
 * Added support for phpBB and the wiki being on two different servers/databases.
 * With the new release of MediaWiki 1.5, I was able to disable some template stuff.


 * Release 1.9
 * Now auto detects MySQL version and uses the correct query.
 * Ver 1.9 will work on both MySQL 4.0.x and 4.1.x


 * Release 1.7
 * Added the code to allow the admin to disable the phpBB wiki group requirement.


 * Release 1.5
 * MediaWiki forces all usernames into a first letter uppercase the rest lower case. (gotroot becomes Gotroot) This is ok until you have a user who has an uppercase letter in the middle of their name. (RetroFit becomes Retrofit) This can cause a problem when trying to Auth with the phpBB user table. I do not have a fix for this. (FIXED)