Home > Linux, PHP > SMF and MediaWiki Bridge

SMF and MediaWiki Bridge

February 12th, 2008 Leave a comment Go to comments

After testing out both bridges currently available for SMF and MediaWiki I decided to write my own. Let me first go through what I liked and didn’t like about the existing bridges.

First Bridge:
http://www.mediawiki.org/wiki/Extension:SMF_Authentication

This bridge allows for auto authentication by using the smf_api.php. Due to the number of files required I did not test this bridge. I didn’t want to deal with the hassle when upgrading software down the road. Especially because SMF 2.0 database tables are different and I wasn’t sure if the smf_api.php would be updated.

From looking at the code if a user is demoted from the administrator position it does not remove him from the wiki sysop group. It is also lacking the ability to declare an SMF group that is only allowed to edit the wiki.

Second Bridge:
http://www.mediawiki.org/wiki/Extension:SMF/Users_Integration

This bridge does not do anything with auto authentication. It does allow you to specify a SMF group that is allowed to edit the wiki. Another plus is that it is a single file. The downside is the configuration does not use the values from SMF’s Settings.php. You have to specify the database tables and permissions. It also doesn’t set wiki sysop privileges for SMF administrators.

I did test this one out and found a small issue where they did not disable the change password option in the wiki. This only requires a change of true to false, which must have been an oversight. Neither of these two bridges check to make sure the users are activated and not banned before logging them in.

My Bridge:
http://www.mediawiki.org/wiki/Extension:SMF_Auth_Integration

The SMF and MediaWiki integration I built only requires one file placed in the wiki extensions directory. To get started you only need to configure the relative path to your SMF forum and the forum’s version. The version will either be 1.1 or 2.0 (which only applies to charter members as 2.0 has not been released). In the default configuration the wiki login is separate from the forum. It will assign and remove sysop privileges to SMF administrators and allow you to lock down editing to an SMF group. You can even supply additional groups to be granted wiki sysop privileges.

For the auto authentication I have decided not to use the smf_api.php file for the above reasons. When you click login / logout the wiki redirects you to the SMF page and then back to the wiki. A couple of gotchas are that you must be using SMF database sessions (default setting). You also need to configure SMF to make sure local storage of cookies are disabled. You might not need to do this if your wiki is inside your forum folder.

There are two known issues. The first involves the wiki’s limitation with user names containing an underscore. The wiki converts underscores to spaces. For example john_doe would become John doe. The workaround I implemented was to look for both the user name with spaces and underscores. The first registered SMF user name is used. If you happen to have a conflict you’ll need to change the later registered user name.

The second is when wgSMFLogin is disabled. If you register a new account from the wiki you will not be redirected back to the wiki as SMF does not have support for this in their code.

You can download the bridge from http://wgnrs.dynalias.com/smf/Auth_SMF.php

Categories: Linux, PHP Tags: ,
  1. Iulian
    March 18th, 2008 at 12:14 | #1

    Very nice, thank you very much.

  2. March 24th, 2008 at 04:15 | #2

    http://pawsitivevybe.com/discdogopedia

    Hey there.

    I am interested in this extension.

    I’m wondering if there are any problems with this mod if the SMF forum is already bridged to Joomla.

    Will it still work?

    Cheers,
    Ron
    http://k9disc.com

  3. September 9th, 2008 at 01:28 | #3

    Is your bridge working on MW 1.6.10?

    You can go to my site and see the error message I have.

    Thanks for your help

    Manil

  4. September 9th, 2008 at 09:07 | #4

    I haven’t tested the bridge with MW 1.6. I have read that they changed the name of the “AutoAuthenticate” hook to “UserLoadFromSession”. Find and replace the following line in the Auth_SMF.php

    $wgHooks[‘AutoAuthenticate’][] = ‘AutoAuthenticateSMF';

    to

    $wgHooks[‘UserLoadFromSession’][] = ‘AutoAuthenticateSMF';

  5. September 9th, 2008 at 09:49 | #5

    Worked like a charm….thanks!

  1. No trackbacks yet.