Customizing SMF > Bridges and Integrations

MediaWiki SMF Bridge not working - No auth, portal removed...

<< < (4/6) > >>

Great thread (and I'm glad to hear that I'm not the only one that I'm struggling with this as well).

Here's some of the tracing I've done (keep in mind that I'm not a web developer - I basically know just enough PHP to be dangerous (usually to myself!). This is a cut and paste portion of an e-mail I just sent off about this:

--- Quote ---The ultimate issue that seems to be triggering my problems is that while
the code is able to derive $ID_MEMBER from the SMF cookie,
$smf_member_id (i.e. the double check from the database) never changes
from its default value of 0, so this bit of code runs:

// We have tried all we can, but the data just doesn't match up.
if (empty($smf_member_id) || $smf_member_id != $ID_MEMBER)
      // TODO: Log errors if the ids don't match?
      if ($user->isLoggedIn())
      return true;

and thus I'm logged out (and if $wgSMFLogin is set to true, my SMF
session is killed as well). I also see the same logic running when
$wgSMFLogin isn't set:

      // No id, you must be unauthorized.
      if ($smf_member_id == 0)
         return false;

So I went hunting for smf_member_id and found it stored properly (i.e.
the value is the same as my account ID in the SMF database) as a BLOB in
the mw_user_properties table. What seems to be broken (at least right
now!) is that the getOption call to get that value never seems to
actually return the value stored in the database. The value (as far as
the bridge code is concerned) remains zero, thus the double check
continuously fails.
--- End quote ---

@ajbaldwin, thanks for your input, hopefully we will manage to solve it somehow.

For the record, I have noticed that:

- If I access the forum first, I can login and then, when accessing the wiki, authentication is working (although I am still having an odd behavior with MediaWiki's Short URLs)

- If, on the other hand, I enter the wiki first and then I click the login link, it takes me as expected to the forum's login page. However, it is impossible to login, with the forum always complaining about cookie's settings on my browser.

It seems that:

- The cookie must be created by the forum, and the wiki can read it without problems
- The forum can't overwrite the cookie (or I have not found how)

Here you go anyone wanting to use this :D

Go to around line 247

comment out the following

--- Code: ---if (empty($smf_member_id) || $smf_member_id != $ID_MEMBER)
// TODO: Log errors if the ids don't match?
if ($user->isLoggedIn())
return true;

--- End code ---

It'll stop you being logged out  after everything setup. No need to use any other fixes. Keep $smf_member_id = $user->getOption('smf_member_id'); in.

EDIT: Just read above lol. Can't believe i missed that. Ah well ¬¬. Im sure we'll figure out the smf_member_id next :D

I had this working and then upgraded to Mediawiki 1.18 and SMF 2.0.2 and I ran into the same unable to login / getting redirected to the forums main page.

I got mine (mostly) working again with this fix:

--- Quote ---I changed line 176 of mediawiki/extensions/Auth_SMF.php from

$smf_member_id = $user->getOption('smf_member_id');


$smf_member_id =  $user_settings['id_member'];

and the login integration works fine. $user doesn't have any data set up at that point and $smf_member_id is never set so the authentication fails down the line.
--- End quote ---

However, there were still some issues.  The new LocalSettings.php seemed to be missing some content:

--- Quote ---# NOTE: Make sure to configure the wgCookeDomain below
--- End quote ---

But the new LocalSettings file (see https:// did not seem to contain the line that actually set the wgCookieDomain.  So I had to add that back in from my previous version of LocalSettings.

--- Quote ---# Make sure "Enable local storage of cookies" is unchecked in the
# SMF Admin -> Server Settings -> Feature Configuration section
# www . domain . org / wiki and www . domain . org / forums -> www . domain . org
# wiki . domain . org and forums . doman . org -> .domain . org
#$wgCookieDomain = 'www . domain . com';
$wgCookieDomain = 'domain . com';
#$wgCookiePath = '/'; // Optional, defaults to '/'
#$wgCookieSecure = false;  // Optional, only change on scheme mismatch

--- End quote ---

Also, if I logged in and out from the forums, all was good.

If I logged out from the logout link on the Wiki page, a cookie got set, and then I couldn't log back in at all.  Using the Login/Logout links from the Wiki didn't seem to work.  If I cleared the cookies and used just the login links from SMF, all seemed to work fine.

I borrowed code from http:// www . mediawiki . org / wiki / Extension:AutomaticREMOTE_USER#Disabling_Login_and_Logout_Links to remove the login/logout options from the Wiki page.  So, the user *has* to login/logout from the forums.  This seems to work.

(It wouldn't let me post actual links, so they are broken up with spaces.)

Aleksi "Lex" Kilpinen:
Hi nyall, any updates on this? :)


[0] Message Index

[#] Next page

[*] Previous page

Go to full version