WordPress.org

Support

Support » Plugins and Hacks » share user login between Mediawiki and wordpress

share user login between Mediawiki and wordpress

Viewing 15 replies - 1 through 15 (of 18 total)
  • Hi Heliotropen,

    it is the same for me: a wall of silence (or outdated information – it is more or less the same…) when it comes to the question to integrate Mediawiki and WordPress (and vice versa). And I would like to use both (or three: looking at bbpress). That would be the best of all three worlds: WP, BBpress and Mediawiki. Is there anyone around taking the challenge to get them all down to the same user authentification mechanism? That would be great!

    regards

    i want to use MediaWiki with WordPress too! Anyone found a DECENT solution yet? I’ve heard of SingleAuth but it’s not ready yet!!

    Just another “me too” — If anyone finds a reasonable way to do this I’d love to know about it.

    I thought of going the OpenID route with the site(s) – but that may be beyond the pale for this particular set of users.

    ME TOO!!!

    Sorry guys, I’m just another on of those.

    how about just put them in the same db, but with different prefixes, and specify a different name for the users table.
    i have a sudden feeling it won’t be this simple, because nothing ever is anymore…
    as long as they both access the able with the equivalent of ARRAY_A then you could just add the extra wordpress columns to the mediawiki database, or visa versa…

    Slamlander
    Member

    @slamlander

    Hery is currently busy with Joomla stuff. Besides, I don’t think he has access to a PHP5 server. I’ll see what I can do to fix it.

    The Slamlander

    I’ll join the chorus… and especially applaude the latest post to this thread! That sounds truly interesting Slamlander – I’ll be sure to check back for any news on a possible fix!

    pnaw10
    Participant

    @pnaw10

    Adding another “me too!” here becuase it’s been two months since anything’s happened on this thread.

    I’m thinking about adding a MediaWiki to one of my websites, but it HAS to be able to use the same logins as the existing WordPress site. I already have nearly 100 WP users (they have to login to post comments). Requiring them to create separate logins for MediaWiki would be a complete dealbreaker.

    Jonathan
    Member

    @jondavis

    I was just able to get hery’s to work. Looking over the code, it all looks safe enough to use with PHP5. A vanilla setup of the AuthWordpress.php file results in logins always failing. The problem is in authenticating the password. That’s relatively easy to fix by importing some of WordPress’s new hashing functionality in class-phpass.php. I literally made 3-line changes to AuthWordpress.php and got it working with WordPress 2.6 and MediaWiki 1.12 (as of this writing the latest version).

    After line 58 add the require line for class-phpass.php so it looks like this:

    require_once('AuthPlugin.php');
    require_once('../wp-includes/class-phpass.php');

    You may need to adjust your path to class-phpass.php depending on your file layout. In my setup, MediaWiki is in a sub-directory of the WordPress install (e.g. /wordpress/wiki, so the path to the class would be /wordpress/wp-includes/class-phpass.php)

    Next you need to alter the authenticate() function in AuthWordpress.php to use the new password hasher.

    Around line 175 (176 if you added the line above), find the line that looks like this:
    if( $res && ( $res->user_pass == MD5( $password ))) {

    Add the following code as a new line BEFORE the if statement to create the PasswordHash object:
    $wp_hasher = new PasswordHash(8, TRUE);

    Now replace the if line:
    if( $res && ( $res->user_pass == MD5( $password ))) {

    with the following:
    if( $res && $wp_hasher->CheckPassword($password, $res->user_pass)) {

    Boom, login works. Now if only I could figure out how to share the session. Hope this helps someone else.

    Jonathan
    Member

    @jondavis

    Ok, one follow-up. When logging in to MediaWiki from an account that exists in WordPress, but does not (yet) exist in MediaWiki there is a problem creating/copying the account into MediaWiki with AuthWordpress.php

    Find the setPassword() function (around line 272) and change:
    return false;

    to:
    return true;

    I think hery was thought that it would set the password in WordPress, when it is actually setting the password in the MediaWiki authentication database. Admittedly, I can’t blame hery, the comments in the code are a bit ambiguous when it just says to “the authentication database”.

    So 4 lines of changes. Still not bad, thanks hery!

    script links both dead. jondavis, you should consider releasing what you made. would be helpful.

    edit:
    http://wordpress-malagasy.googlecode.com/svn/wp/misc/wordpress-mediawiki/AuthWordpress.php

    these changes don’t work for me using wp2.6. the user_password fields in MW are blank and logins fail. will update if i find a solution.

    correction– script does work. mediawiki was throwing internal server errors and “password is too short” due to the test account’s password being the same as the username. the db inserts were then failing half way through with blank password entries.

    Jonathan
    Member

    @jondavis

    Ok, the script I modified is available for download off my blog. I wasn’t aware that hery took his original down.

    Here’s a link to the blog posting with a download available of the modified AuthWordpress.php and full installation instructions:

    WordPress, bbPress & MediaWiki

    I’d appreciate postings of others who get it to work. Feel free to let me know if you run into problems so I can improve the instructions.

    pnaw10
    Participant

    @pnaw10

    Thanks for posting that. Have you tried this with WordPress 2.5.1 by any chance? I’ve been holding back on the 2.6 upgrade because of the widget problem and other things I’m not totally convinced about yet.

    I wouldn’t mind giving it a shot if the results are currently unknown. But if you or anyone else has already attempted and failed, I won’t waste my time… I’ll just bite the bullet and upgrade to 2.6.

Viewing 15 replies - 1 through 15 (of 18 total)
  • The topic ‘share user login between Mediawiki and wordpress’ is closed to new replies.