Extension:WPMW

WPMW is an extension for integrating a MediaWiki within a WordPress installation. It is currently working and useful, but beta-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.6 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 (or see if you want it somewhere else). 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:

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

If wordpress is already installed and it is giving you trouble installing MediaWiki into a folder under the wordpress root, add this to the .htaccess file in the wordpress root folder.

This tells wordpress installed to the "wp" folder to ignore the "wiki" folder and not to try to forward it to a "forbidden" page.

Wordpress Answers on ignoring a subfolder

Other Install Locations
If you already have, or want to have, MediaWiki installed at a different location relative to your WordPress installation, you can do that by specifying a relative path FROM the MediaWiki directory TO the WordPress directory. In the default setup where WordPress is at  and MediaWiki is at /wiki, this relative path is.

To change it, just add a line in your MediaWiki's. The following example is where  contains MediaWiki and   contains WordPress:

This line must be placed BEFORE.

However, if the MediaWiki directory doesn't sit below the WordPress directory, MediaWiki will not see the WordPress login cookies, so some of the integration will not work smoothly. To fix that, you simply need to install the root-cookie WordPress plugin or according to the discussion, navigate to your current WordPress theme's root directory, and add the following lines of code to :

Installing the MediaWiki Extension
You can either download the archive from GitLKab or clone the git repository into the MediaWiki extensions directory, i.e. . In either case name the folder. Then add the following lines to :

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:

Everything else will still function as normal.

=Usage= Once everything is set up there is not much else you need to do.

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.