SMF and MediaWiki Bridge

Started by rsw686, February 08, 2008, 08:28:51 PM

Previous topic - Next topic

klra

Ok, that makes sense.

It looks like I'll be either using an available skin and modifying it's header/images, and then changing the css to match my forum's default colors.

It sure would be nice to have a theme that was based on the SMF default theme. Once I get more into this, I might just make a new theme that does just that, with permission from SMF of course.

rsw686

I've just updated the integration file. I have made the following changes:

Work around underscores in usernames when wgSMFLogin is disabled. For example john_doe becomes John doe. We check for both cases and use the first registered SMF user. Either change the later registered users or set wgSMFLogin to enabled.

Allow an array of multiple groups to be used for wgSMFGroupName. These are the groups that are allowed to login to the wiki. So you can use either of these formats.

$wgSMFGroupName = 'Wiki Editor';
$wgSMFGroupName = array('Wiki Editor', 'Global Moderator');

Add wgSMFAdminGroupName to define groups that should be granted wiki sysop rights (SMF Administrators are always granted sysop rights). This will accept an array as well.

$wgSMFAdminGroupName = 'Wiki Admin';
$wgSMFAdminGroupName = array('Wiki Admin', 'Global Moderator');

Added support for SMF 2.0 with wgSMFVersion. You know have to define one of the following.

$wgSMFVersion = "1.1";
$wgSMFVersion = "2.0";

I haven't gotten to test out the SMF 2.0 support since I don't have a copy. I have a feeling it should work. I just made a map of the table fields using the name scheme from the Coppermine SMF 2.0 bridge.
The Reptile File
Everything reptile for anyone reptile friendly

Aquaria Talk
Community for freshwater and saltwater aquariums enthusiasts

rsw686

I think this will be the last update for awhile unless I noticed any more bugs.

- Authenticate emails for new wiki users when wgSMFLogin is enabled.
- Enable passwords to be changed via the wiki when wgSMFLogin is disabled.
- Don't allow banned or unactivated users to log on when wgSMFLogin is disabled.

Here's the download link http://wgnrs.dynalias.com/smf/Auth_SMF.php
The Reptile File
Everything reptile for anyone reptile friendly

Aquaria Talk
Community for freshwater and saltwater aquariums enthusiasts

Slack

RSW,

Thanks for doing the bridge - we've got it on a test site, looks very nice and we'll give it a good test.

Cheers,

rsw686

Quote from: Slack on February 13, 2008, 07:59:27 PM
RSW,

Thanks for doing the bridge - we've got it on a test site, looks very nice and we'll give it a good test.

Cheers,

Great to hear! I'm looking forward to hearing how it works out for you.
The Reptile File
Everything reptile for anyone reptile friendly

Aquaria Talk
Community for freshwater and saltwater aquariums enthusiasts

Slack

Hi Ryan,

I like the bridge, I've installed it on two sites now, we are fooling around with mediawiki trying to learn how it works and we plan on adopting it in some form.... very cool software.

We do have a problem with sessions.  It seems that when we load the MW the user info is transferred but the session data is not.  IOW, MW shows th user as logged in but when you go to change something in user preferences, or edit a page for example, the changes will not or cannot be saved until you log out and log back in.

Any tips on how to troubleshoot this?

I've got a bridged Mambo/SMF system and I'm calling MW in a new browser window.

Thanks,  really like the simplicity and the editing permissions by group.

Slack

rsw686

You are using version 1.4 correct? If so I just noticed this as well. Never noticed it with previous versions. The only thing I changed was to update the email and real name if it was changed in SMF. Try commenting out lines 221 and 222 in the AutoAuthenticateSMF function. It should look like this


$user->loadFromDatabase();
//$user->setEmail($user_settings[$smf_map['email_address']]);
//$user->setRealName($user_settings[$smf_map['real_name']]);


If that defiantly fixes it then I will try it figure out how to update that information without messing up the session data. Not really sure how it messes up the session, but I guess it does.
The Reptile File
Everything reptile for anyone reptile friendly

Aquaria Talk
Community for freshwater and saltwater aquariums enthusiasts

rsw686

I spoke too soon. It still does it. I'll track it down. In the meantime when it says "Sorry! We could not process your edit due to a loss of session data. Please try again. If it still doesn't work, try logging out and logging back in." just scroll down and click save again.
The Reptile File
Everything reptile for anyone reptile friendly

Aquaria Talk
Community for freshwater and saltwater aquariums enthusiasts

Slack

Yes, using SMF 1.4

Have tried clicking save repeatedly but still get the "...due to loss of session data" message and it will not save until you actually log out and then log back in.

Thanks!

rsw686

The Reptile File
Everything reptile for anyone reptile friendly

Aquaria Talk
Community for freshwater and saltwater aquariums enthusiasts

Slack

So far, so good Ryan - very nice!

Thanks!

rsw686

Just released version 1.6.

http://wgnrs.dynalias.com/smf/Auth_SMF.php

I think this has everything all fixed up. Here's the change log.

- Use existing wgAuth instead of creating a new class.
- Clarify and clean up source code commenting.
- Use set and get for user class instead of directly assigning variables.
- Fix bug introduced by change password for new members when wgSMFLogin is disabled.
- Fix admin check error for usernames with space or underscore when wgSMFLogin is disabled.
- Load user from database only if no previous session when sgSMFLogin is enabled.
- Alert for unexisiting username with space or underscore when wgSMFLogin is disabled.
The Reptile File
Everything reptile for anyone reptile friendly

Aquaria Talk
Community for freshwater and saltwater aquariums enthusiasts

Slack


rsw686

I just released version 1.7. Sorry for all the updates, at least there is only one file to replace.

- Provide error message when SMF group name is invalid.
- Fix login/logout redirection with new browser session when wgSMFLogin is enabled.

The second fix solves the known issue listed below. It just finally clicked on how to fix it.

- When wgSMFLogin is enabled if you start a new browser session and login from wiki without first going to a forum page you will not be redirect back to the wiki after login. This is because SMF has not yet started a session.

I think that's the last of all the issues. Its been working great on both my sites. I don't plan to make any more revisions unless somebody points out a problem or feature that would be beneficial.
The Reptile File
Everything reptile for anyone reptile friendly

Aquaria Talk
Community for freshwater and saltwater aquariums enthusiasts

rsw686

The Reptile File
Everything reptile for anyone reptile friendly

Aquaria Talk
Community for freshwater and saltwater aquariums enthusiasts

ecpcorran

I get the following error message because I've renamed my SMF administrator group.

"Unable to find SMF group called "Administrator" set in LocalSettings.php!"

When I rename the SMF group to Administrator, everything appears to work fine.  Is there another way for you to check for the administrator group such as checking if it has a group id of 1?

Thank you for making this extension.  : )

rsw686

Quote from: ecpcorran on February 24, 2008, 12:05:49 AM
When I rename the SMF group to Administrator, everything appears to work fine.  Is there another way for you to check for the administrator group such as checking if it has a group id of 1?

Didn't even think about that you could rename the administrator group. I have released version 1.8 that fixes that.

http://wgnrs.dynalias.com/smf/Auth_SMF.php
The Reptile File
Everything reptile for anyone reptile friendly

Aquaria Talk
Community for freshwater and saltwater aquariums enthusiasts

ecpcorran

#37
Thanks for the quick reply.  Though I think I've found something else I'd like you to look at as well.  :)

The following two lines are redirecting me to hxxp:www.mydomain.com/wiki/?board=redirect [nonactive] upon login and logout via the wiki login/logout link.  This has the effect of sending me to the wiki main page rather than the article I was looking at prior to clicking the link.

line 267 of v1.8
$_SESSION['old_url'] = 'http://' . $_SERVER['SERVER_NAME'] . $wgScriptPath . '/?board=redirect';

line 288 of v1.8
$_SESSION['logout_url'] = 'http://' . $_SERVER['SERVER_NAME'] . $wgScriptPath . '/?board=redirect';


I've made some adjustments, and the following code seems to work for me:

Replace line 267 with:
If ($_GET['returnto']!=""){ $page = '/' . $_GET['returnto']; } else { $page = ""; }
$_SESSION['old_url'] = 'http://' . $_SERVER['SERVER_NAME'] . $wgScriptPath . '/index.php' . $page . '?board=redirect';


Replace line 288 with:
If ($_GET['returnto']!=""){ $page = '/' . $_GET['returnto']; } else { $page = ""; }
$_SESSION['logout_url'] = 'http://' . $_SERVER['SERVER_NAME'] . $wgScriptPath . '/index.php' . $page . '?board=redirect';

rsw686

That code didn't work for me because of the ?board=redirect hack that needs to be in place for SMF not to just discard the link. However I changed it up some and got it working. Let me know if this version works for you or not.

Line 267

$page = !empty($_GET['returnto']) ? '?title=' . $_GET['returnto'] . '&' : '?';
$_SESSION['old_url'] = 'http://' . $_SERVER['SERVER_NAME'] . $wgScriptPath . '/index.php' . $page . 'board=redirect';


Line 291

$page = !empty($_GET['returnto']) ? '?title=' . $_GET['returnto'] . '&' : '?';
$_SESSION['logout_url'] = 'http://' . $_SERVER['SERVER_NAME'] . $wgScriptPath . '/index.php' . $page . 'board=redirect';
The Reptile File
Everything reptile for anyone reptile friendly

Aquaria Talk
Community for freshwater and saltwater aquariums enthusiasts

ecpcorran

#39
That works for me.  : )

Well, to an extent it seems..  It successfully logs out, but sometimes the wiki has the appearance that I'm still logged in until I refresh the page or click a few links.


..I'm not sure how to duplicate the issue reliably, but it seems to happen primarily if I log out immediately after logging in.   Sometimes it happens, sometimes it doesn't.  I'm thinking it may be browser cache related.


Edit:  Yep, it seems to be the cache.  Setting $wgCachePages = false; in LocalSettings.php fixes my problem.  : )

Advertisement: