Extension:WPMW

WPMW is a solution for integrating a MediaWiki within a WordPress installation. It is currently working, but alpha-quality.

=Installation=

To install, it is assumed you already have a working WordPress installation. Although WPMW may work with other versions, it only tested and maintained on an ongoing basis against the latest WordPress, which is 3.3 at the time of writing. You will also need at least version 1.18.0 of MediaWiki.

Installing MediaWiki
The first thing to do is install MediaWiki in a 'wiki' directory below the root of your WordPress installation. You can use a separate database, or the same one as WordPress uses. Once installed, it's a good idea to set it up to use 'clean' URLs, although it won't affect WPMW if you don't. The following in wiki/LocalSettings.php should do it:

$wgUsePathInfo = false; $wgArticlePath = '/wiki/page/$1';

(when combined with something like this in .htaccess in the wiki directory:

RewriteEngine on RewriteRule ^/$ /page/Main_Page RewriteRule ^page/(.*)$ index.php5?title=$1 [L]

Installing the MediaWiki Extension
Next, the AuthWP.php file (latest version here, or see http://projects.ciarang.com/p/WPMW for full project info) needs to be copied into the MediaWiki extensions directory, i.e. wiki/extensions. Then add the following lines to wiki/LocalSettings.php:

require_once('extensions/AuthWP.php'); $wgAuth=new AuthWP;

Installing the WordPress Plugin
There isn't a WordPress plugin yet (although there may be later) so you've already finished the installation.

Single Registration Page
Although this setup supports allowing users to register via either the WordPress or MediaWiki user interface, you may wish to restrict registration to the WordPress interface only. This provides less of an 'attack surface' for automated spammy registrations. To do so, simply disable registration in the MediaWiki configuration:

$wgGroupPermissions['*']['createaccount'] = false;

Everything else will still function as normal.

=Status=

What Works
A.k.a. what should work - bug reports welcome:
 * If you have a Wordpress account, you can use the same details to log into MediaWiki. If there is not already a MediaWiki account for the user, it is created there and then.
 * If you register an account via the MediaWiki interface, an account is automatically created in WordPress. The account will have default settings for most things - specifically the role will be Subscriber, the same as if the user registered via WordPress. (But I suggest turning this off, as detailed above)
 * If you log in on the WordPress site, you will automatically be logged in to MediaWiki when you visit it.
 * If you log in on MediaWiki, you are automatically logged in to WordPress.
 * If you log out of MediaWiki, you will automatically be logged out of WordPress.
 * If you change your email address or real name in WordPress, the MediaWiki account details will be updated the next time you log in there (which includes simply visiting it while logged in to WordPress).
 * Changing email address and real name in MediaWiki is disabled - you have to change them via WordPress.

What Doesn't Work Yet
A.k.a todo list:
 * You can register an account in WordPress that has a user name that is invalid in MediaWiki. In that case, you won't be able to log in to MediaWiki.
 * If you log out on WordPress, you stay logged in on MediaWiki.
 * If you create an account in MediaWiki and don't specify an email address, the corresponding WordPress account will not be usable until you do specify one. (Either by updating in MediaWiki, or by an admin doing it for you in WordPress. (Again, I suggest turning this off anyway, see above)
 * I thought WordPress should be sending a 'new user' notification email to the site admin when a user registered on MediaWiki, but it doesn't seem to be working currently.