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
http://www.simplemachines.org/community/index.php?topic=195978.0
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 also looks to create two instances of an account with the auto authentication due to wiki requiring upper case for the first letter and it doesn't format the name with ucfirst. Please note that I could be wrong, but these were issues I ran into when using similar code.
One feature it is lacking is 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. For one they did not disable the change password option in the wiki, which doesn't work anyway due to the rest of the code not being there. This only requires a change of true to false, which must have been an oversight.
My Bridge:
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. 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.
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.
The bridge also supports SMF usernames with underscores. MediaWiki converts underscores to spaces which causes authentication problems with almost all other bridges. I developed a work around by checking for the first registered SMF username with spaces or underscores. It is very unlikely that two SMF users will have the same name like john_smith and john smith. If they do you'll need to change the username of the later registered SMF user.
You can download the bridge from http://wgnrs.dynalias.com/smf/Auth_SMF.php
Does your bridge have an issue (like the others) with members that have a _ or - in their username?
I am seriously thinking of setting this up for my forums & members.
Also, would an bridged installation be viewable to all on the net or just to the forum members?
I'd like to have our Wiki viewable by all, but with permissions set so that only Admins, Mods or possibly forum members would be able to edit the content of the Wiki.
Thanks!
Quote from: klra on February 09, 2008, 12:02:09 PM
Does your bridge have an issue (like the others) with members that have a _ or - in their username?
I am seriously thinking of setting this up for my forums & members.
Also, would an bridged installation be viewable to all on the net or just to the forum members?
I'd like to have our Wiki viewable by all, but with permissions set so that only Admins, Mods or possibly forum members would be able to edit the content of the Wiki.
Thanks!
I'll test out the _ and - in the user names and get back to you. The wiki is viewable by all. Administrators can always edit. By default only members can edit. If you don't want members to edit, just create a new SMF group and assign nobody to it. Configure the wiki LocalSettings.php value to that group name. Then you can add members as needed to that group and they will be allowed to edit.
Ok, I'm gonna look closely at this Wiki & bridge, as it's something that Ive wanted to ad to my website & forums.
Not being very good with code, I'm hoping to see some more installation info about how to impliment the bridge if you are so inclined.
Thanks for writing this!
QuoteIf you don't want members to edit, just create a new SMF group and assign nobody to it. Configure the wiki LocalSettings.php value to that group name. Then you can add members as needed to that group and they will be allowed to edit.
So the permissions can be set up to only allow specific membergroups to edit the Wiki- this is great because then I can allow only veteran/trusted members access.
This will prevent new members and malcontents from posting irrelevant data.
Usernames with - work correctly using the wiki login separate or with the auto authentication. If you have a _ in your username it only works with the auto authentication. The wiki software converts _ to a space. I could convert it back to a _, but then there could be a conflict with a username with a space. I'll look into it.
Thanks- I wasn't sure if this would be an issue with the members that have one of those characters in their username or not.
I don't think it would be an issue though, as I think I will be only allowing editing access to Admins, Mods and specific high post count members - and if they have have one of those charachters in their username, I could encourage them to change their name if they want access.
Quote from: klra on February 09, 2008, 01:39:06 PM
Thanks- I wasn't sure if this would be an issue with the members that have one of those characters in their username or not.
I don't think it would be an issue though, as I think I will be only allowing editing access to Admins, Mods and specific high post count members - and if they have have one of those charachters in their username, I could encourage them to change their name if they want access.
Yeah for now I'm just going to say user names with _ in them won't work using the wiki login. They do work fine if you use the auto authentication.
To get started install the mediawiki software. If you are going to use the same database make sure to set the prefix during the installation. This makes it easy to determine what tables go with what. I used the mw_ like recommend.
Afterwards just copy the SMF_Auth.php file to your wiki/extensions directory. Add the lines from the top of SMF_Auth.php to the end of the wiki/LocalSettings.php file. Start with just configuring the $wgSMFPath path. Once you get this right you should be able to login with your forum name via the wiki login.
Then you can enable the other settings to configure the auto authentication part.
Will there be a Wiki tab in the forums or will I have to create one?
And if I do have this Tab/link, will going to the Wiki from the forums do the auto login ?
I think that would be best. Then setup the Wiki to have no front end login on the wiki page itself. This would then allow editing access through the forums only by those logged in, authorized members.
Also, expect some more questions about implimentation/installation of this bridge, as I (annd maybe some other folks here) may have questions about it. I know I do already-
QuoteIf you are going to use the same database make sure to set the prefix during the installation. This makes it easy to determine what tables go with what. I used the mw_ like recommend.
That went right over my head.
Sorry, but it looks like I'll need a bit more guidance -
Quote from: klra on February 09, 2008, 02:05:14 PM
Will there be a Wiki tab in the forums or will I have to create one?
Nope you have to add the tab yourself. The integration only deals logins. I modified a wiki theme to make it match my site.
When you set the auto authentication ($wgSMFLogin = true;) the login / logout links of the wiki will redirect you to the forum login page and use the forum logout function. Navigation to the wiki when logged into the forum will auto log you into the wiki.
Quote from: klra on February 09, 2008, 02:07:26 PM
QuoteIf you are going to use the same database make sure to set the prefix during the installation. This makes it easy to determine what tables go with what. I used the mw_ like recommend.
That went right over my head.
Sorry, but it looks like I'll need a bit more guidance -
After you upload the mediawiki files and navigate to it with your browser it will walk you through the installation. You need to decide if you are going to create a new mysql database for the wiki or use the exisiting mysql smf database. It doesn't really matter, its more about how you want it organized. Both work the same. I just used the SMF database.
If you use the SMF database you would fill in the database name and login username and password. Towards the bottom it asks if you want a table prefix. Fill in mw_. This way it will name the tables mw_users, etc vs just users. The SMF tables are smf_members, etc. This keeps it organized.
QuoteNope you have to add the tab yourself. The integration only deals logins. I modified a wiki theme to make it match my site.
No sweat there, pretty easy to do.
QuoteWhen you set the auto authentication ($wgSMFLogin = true;) the login / logout links of the wiki will redirect you to the forum login page and use the forum logout function. Navigation to the wiki when logged into the forum will auto log you into the wiki.
Good to hear.
QuoteAfter you upload the mediawiki files and navigate to it with your browser it will walk you through the installation. You need to decide if you are going to create a new mysql database for the wiki or use the exisiting mysql smf database. It doesn't really matter, its more about how you want it organized. Both work the same. I just used the SMF database.
I'll probably go with a seperate, dedicated database for the Wiki, completely seperate from the SMF database.
QuoteIf you use the SMF database you would fill in the database name and login username and password. Towards the bottom it asks if you want a table prefix. Fill in mw_. This way it will name the tables mw_users, etc vs just users. The SMF tables are smf_members, etc. This keeps it organized.
So what does this mean to me as I will be installing a new database?
sorry, another question-
QuoteI modified a wiki theme to make it match my site.
How did you do that?
There was very little guidance on how to do this at the Wiki site (Configuration).
Quote from: klra on February 09, 2008, 02:15:27 PM
QuoteIf you use the SMF database you would fill in the database name and login username and password. Towards the bottom it asks if you want a table prefix. Fill in mw_. This way it will name the tables mw_users, etc vs just users. The SMF tables are smf_members, etc. This keeps it organized.
So what does this mean to me as I will be installing a new database?
Don't worry about it then.
Quote from: klra on February 09, 2008, 02:16:51 PM
How did you do that?
There was very little guidance on how to do this at the Wiki site (Configuration).
I just took the html code for my header and added it above the wiki template code. Then I changed the css values for the colors. The link to my site is in my signature.
Have a look here for the wiki skins. Mine is a modified version of KindofBlue.
http://meta.wikimedia.org/wiki/Gallery_of_user_styles
That look great!
So you are using a custom SMF theme, and the bridge makes the wiki in the same format?
Or is your site a Tiny Portal setup in SMF?
Not sure how you did it, as the wiki seems to seamlessly integrated into your site/forums-
The reason I ask about your setup is because of the integration.
My site is Joomla based, and not bridged to the forums (SMF1.1.4).
Quote from: klra on February 09, 2008, 02:31:28 PM
That look great!
So you are using a custom SMF theme, and the bridge makes the wiki in the same format?
Or is your site a Tiny Portal setup in SMF?
Not sure how you did it, as the wiki seems to seamlessly integrated into your site/forums-
The bridge does nothing with the wiki layout. All it does is link the username / password logins.
My site uses SMF, the SMF SSI.php functions for the front page, Coppermine for the gallery (it has a built in bridge to integrate with SMF), and MedaWiki with the integration I made.
The theme for SMF is one I created. It involves a div wrapper for the entire page and a table for the header and menu. I took this header and modified the Coppermine theme the same way. I then did the same thing for the KindofBlue mediawiki skin.
Thus when you go to them they all look the same. I'm not sure how else to explain how I made the theme. It isn't the easiest thing to do and really just takes some time to get everything lined up exactly right.
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.
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.
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
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,
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.
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
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.
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.
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!
Version 1.5 should fix it. Let me know.
http://wgnrs.dynalias.com/smf/Auth_SMF.php
So far, so good Ryan - very nice!
Thanks!
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.
Thanks Ryan - I'll update!
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.
For anybody interested I put a page up on MediaWiki.
http://www.mediawiki.org/wiki/Extension:SMF_Auth_Integration
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. : )
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
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 www.mydomain.com/wiki/?board=redirect 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';
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';
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. : )
Quote from: ecpcorran on February 24, 2008, 10:32:37 AM
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. : )
I'll look into it. I have
$wgEnableParserCache = false;
$wgCachePages = false;
set on the wiki that I've been working on the extension with. I'll disable those lines and test. It would be nice to have the cache enabled on a live site as I think it would speed things up.
What browser are you using? I logged in and out multiple times, going to different pages, and making edits. Each time when logging out the top menu bar went back to what it looks like for a guest. What do you do to cause it to happen?
It doesn't seem to happen with IE7.
I'm using Firefox 2.0.0.12 on 64-bit Vista. The website is running on a (mostly) default install of Apache2.
These are the other cache related parameters in my config file:
$wgMainCacheType = CACHE_NONE;
$wgMemCachedServers = array();
I've created a test account and set $wgCachePages back to its default. You can test it in Firefox if you wish:
Login info has been sent via PM
All I'm doing is logging in and immediately logging right out. You might need to do it a couple of time for it to occur.
Aside from randomly altering the link with a random variable (i.e. ?title=Main_Page&board=redirect&rand=Af25 ) I'm not sure what else the extension itself could do fix this unless you have some ability to pass cache related header information to/through smf's logout...
I'm personally fine with setting $wgCachePages to false though I could see why a large site might want this problem resolved without that parameter. It is mostly an annoyance rather than a security risk as I am logged out, it just doesn't immediately reflect it.
Interesting, happened the first time I logged in and back out. I have never seen that before. I'm using Firefox 3 Beta 3 on XP. I'm assuming this is hosted on linux? If so which distro, apache, and php version? Feel free to PM me the info. I'll send you a PM with what I'm using. I have a VMware box so if I have free time I'll probably test it out.
I released version 1.9 that included those changes. When the wgSMFLogin is disabled it uses the first registered user when there is a conflict with underscores and spaces. However I wasn't doing the same thing when wgSMFLogin was enabled. It would allow both users to post. Since is was storing data in the tables with the _ in the username certain wiki features (like contribs) wouldn't show any revisions for that user. I fixed this by applying the same logic and only allowing the first registered user to be auto logged in. Then I format the username to the wiki standards.
Anyway if you had wgSMFLogin set to enabled and a user with an underscore posted you can fix the database by running the following SQL statements. Be sure to fill in your username and set the correct prefix for the tables. By default media wiki uses no prefix.
UPDATE mw_user SET user_name = 'john smith' WHERE user_name = 'john_smith'
UPDATE mw_revision SET rev_user_text = 'john smith' WHERE rev_user_text = 'john_smith'
UPDATE mw_recentchanges SET rc_user_text = 'john smith' WHERE rc_user_text = 'john_smith'
Hi Ryan, nice bridge! :)
Does it work for Post Count based groups? I'm trying to allow forum users who have a minimum number of posts to automatically become Wiki Editors and cannot seem to get it to work if I use post count based groups to do it..... ??
Thanks!
Slack
Quote from: Slack on March 05, 2008, 06:51:51 PM
Does it work for Post Count based groups? I'm trying to allow forum users who have a minimum number of posts to automatically become Wiki Editors and cannot seem to get it to work if I use post count based groups to do it..... ??
Nice catch. Yeah this would be useful. It just took a small change to make it work for post based groups. You can download version 1.10 from http://wgnrs.dynalias.com/smf/Auth_SMF.php
Change Log
- Enable the register redirection hook when wgSMFLogin is enabled.
- Enable support for post based groups. Reported by Slack on SMF.
Excellent! :D
Thanks!
Let me know how that works for you. The one thing to keep in mind is that it allows only that post group. For example consider the default SMF post groups
Newbie 0
Jr. Member 50
Full Member 100
Sr. Member 250
Hero Member 500
If I wanted people with 100 posts or above to be able to log in to the wiki you would have to define the following
$wgSMFGroupName = array('Full Member', 'Sr. Member', 'Hero Member');
Right, not a problem for me since I wasn't using Post Groups -- until now that is, it works perfectly.
Thanks again,
Slack
rsw686,
Can you explain me what are the differences between your bridge and this one - http://www.simplemachines.org/community/index.php?topic=195978.0
Because I would like to choose one of them and I can't figure out what's different between them.
Not to answer for Ryan, but he explains the difference at the very top of this topic.
I tried Snakehits, which I'm sure is a very good bridge, but it is more complicated as it involves installing a number of files. I couldn't get it to work on first installation, so I un-installed. I'm sure with patience I could have gotten it going. It was just easier to install Ryan's bridge and the support - if you read through this thread - has been excellent.
Quote from: Slack on March 06, 2008, 10:10:43 AM
Not to answer for Ryan, but he explains the difference at the very top of this topic.
I tried Snakehits, which I'm sure is a very good bridge, but it is more complicated as it involves installing a number of files. I couldn't get it to work on first installation, so I un-installed. I'm sure with patience I could have gotten it going. It was just easier to install Ryan's bridge and the support - if you read through this thread - has been excellent.
You're absolutely right... stupid me :P
Slack, thanks for the compliments. This reminded me that I should update the first post in this thread.
Paracelsus, if you already gave it a read through take note that I fixed the login/logout redirection issue. I also added the following
"The bridge also supports SMF user names with underscores. MediaWiki converts underscores to spaces which causes authentication problems with almost all other bridges. I developed a work around by checking for the first registered SMF user name with spaces or underscores. It is very unlikely that two SMF users will have the same name like john_smith and john smith. If they do you'll need to change the username of the later registered SMF user."
That is one of the main features which sets my bridge apart. I can guarantee a number of your users have underscores in their user names.
Can we get a simplified 'dummy' version of this
Download X, X...
Put X, X...
Do X, X...
Make Tab X, X...
Thanks
There are no tabs, have you installed MediaWiki?
To install:
Copy and paste from Ryans link above and name the file Auth_SMF.php
Upload that file to your extensions folder.
Copy and paste the LocalSettings options portion of the above file to your LocalSettings.php located in your root wiki folder.
Change those settings to your preferences... which includes a call to the file in your extensions folder.
Upload the updated LocalSettings.php file.
You're in business.
1. Install SMF
2. Install MediaWiki.
3. Place the file in the wiki/extensions directory.
4. Copy/paste the configuration for the top of the extension file into the wiki configuration file.
The comments in the extension configuration are fairly explanatory. If you don't understand a specific part ask.
You will now have a working integration. However, like other integrations, this only deals with the authentication part. It is up to you to modify the themes on the forum ad wiki to add links/style as needed.
It's showing all text? Not a file to download.
http://wgnrs.dynalias.com/smf/Auth_SMF.php
Quote from: JoshieDaMan on March 23, 2008, 12:28:56 AM
It's showing all text? Not a file to download.
http://wgnrs.dynalias.com/smf/Auth_SMF.php
You just have to right-click and select Save Link As (Firefox). I'm sure IE has a similar option. PHP files are text anyway.
Do I need to download the software for wiki? Or just upload Auth_SMF to a certain folder?
Hi, I've tried your bridge today. Well it works fine as long as I am logged in as a user of SMF. But if i want to enter the wiki as "guest"(not logged in), I always get an "500 internal Server Error". The only question is, why? :) I could think of a problem with "register_globals" which is off on my server. Are you using globals in your Bridge?
Thanks for any Help, and keep up the work ;)
Is this your own server? If so reload apache. I have php setup with fast-cgi and I know media wiki will segfault php once every couple of weeks. I haven't found the cause, but it happened whether or not I was using the bridge. At that point I would get the 500 internal server errors. However I did some research and I heard that disabling apc should stop the segfaults, I did that the other day and am waiting to see.
No it isn't my own server, it's hosted by "ovh.net". But I get the 500 error only when i set
"$wgSMFLogin = true;". When I leave the # befor it to comment it, everything works, but the autologin would be nice and easy :)
The only thing I can think of is what I mentioned above. If php is being run by fast-cgi it will keep multiple threads open. One thread would segfault and I would receive the internal 500 error repeatedly on select pages being handled by that thread.
Other than that I'm not sure what the problem could be. The 500 server error issue is hard to diagnose without having access to the server logs to see what actually happened. You could make a page with <?php phpinfo(); ?> and see how php is being run and if apc is installed.
If so you might point your host to this link. I know multiple linux distros are affected. The fix is to disable apc or install an older version. Although since it is 2008 now the newest version of apc might work as well. It seems to occur most on 64-bit intel servers, which mine is.
http://pecl.php.net/bugs/bug.php?id=7141
well on my phpinfo I could find anything about apc, and the only thing with cgi was this:
"Server API CGI "
Hmm I'm not sure. Does the host put the error logs in your site folder? If so you could see what it states. Otherwise you might give your host the link to the page that gives the 500 server error and ask them to let you know what the error is. It should be easy enough for them to tail the error log and then click the link.
Well, i took a shot at installing this and am having major problems.
When I add the variables and so on to the LoclSettings.php file and make appropriate adjustments, when I try to use the mediawiki log out on th page, I get a page not found error.
I am not running any caching. It is my own Solaris 5.10 server running, PHP 5.2.5, MySQL 5.1.23(rc), SMF 1.1.4, MediaWiki 1.12.0, and Apache 2.0.63. Any thoughts? What else do you need?
EDIT: More information. If I change "$wgSMFLogin" to false, then everything seems to be fine. What does that variable actually do? When I set it to "true", I get page not found errors when I try to logout.
Sounds like the path to your forum is not correct, it cannot find your forum log out page - did you follow this example?
# Example: /public_html/forum and /public_html/wiki -> ../forum
$wgSMFPath = "../forum";
Quote from: Slack on April 09, 2008, 04:11:12 PM
Sounds like the path to your forum is not correct, it cannot find your forum log out page - did you follow this example?
I don't think that is the issue as it checks for the Settings.php file existence and will give you an error stating "Check to make sure $wgSMFPath is correctly set in LocalSettings.php!"
Quote from: Skuzzy on April 09, 2008, 03:41:42 PM
EDIT: More information. If I change "$wgSMFLogin" to false, then everything seems to be fine. What does that variable actually do? When I set it to "true", I get page not found errors when I try to logout.
Sounds like you are almost there. The wgSMFLogin allows the extension to use the SMF cookie to auto log you into the wiki.
There are two things to check. I'm going to copy/paste this.
# Make sure "Use database driven sessions" is checked in the
# SMF Admin -> Server Settings -> Feature Configuration section
# NOTE: Make sure to configure the wgCookeDomain below
# Make "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.org';
Chances are it has to do with the Enable local storage of cookies. When changing this setting I've had to clear out my browser cookies for it to start working right. It seems like SMF gets confused as the cookie is written in a different format.
'Enable local storage of cookies' has never been checked.
'Use database driven sessions' has always been checked.
That was the first things I checked.
I just released version 1.12. I never made version 1.11 public so here are the changes from both versions.
The main reason I released this update was to correct an internal server error that started occurring when I upgraded to mediawiki 1.12.0. It turns out that calling the logout function when the user is already logged out will crash php. Not sure what this just appeared now, but it has been corrected.
1.12 - Keep the connection to the database open.
- Fix segfault caused by logging out an already logged out user when wgSMFLogin is enabled.
1.11 - Don't allow banned or unactivated users to log on when wgSMFLogin is enabled.
- Don't allow partially banned users to log on.
Quote from: gubius on April 09, 2008, 10:06:42 AM
No it isn't my own server, it's hosted by "ovh.net". But I get the 500 error only when i set
"$wgSMFLogin = true;". When I leave the # befor it to comment it, everything works, but the autologin would be nice and easy :)
Quote from: Skuzzy on April 09, 2008, 03:41:42 PM
I am not running any caching. It is my own Solaris 5.10 server running, PHP 5.2.5, MySQL 5.1.23(rc), SMF 1.1.4, MediaWiki 1.12.0, and Apache 2.0.63. Any thoughts? What else do you need?
EDIT: More information. If I change "$wgSMFLogin" to false, then everything seems to be fine. What does that variable actually do? When I set it to "true", I get page not found errors when I try to logout.
Looks like you have the same php segfault error I just came across. Sorry I couldn't figure this out sooner. I had free time today and figured I'd upgrade to the latest mediawiki and then it happened to me.
It took a bit with some some echo '1'; exit; statements to find out exactly which line the segfault was happening on. Once I saw it was the logout line it just clicked.
Well, now when I got my error.log, you figure it out ;P
It was this error:
[2008 Apr 14 16:41:34] [error] [client 194.154.212.4] [host www.mfcl.net] Premature end of script headers: /home/mfcljmmv/www/wiki/index.php
That was always posted...with your V12 it works now :)
Glad to hear that it is working for you!
Version 1.13 was just released with the following changes
- Move hook initialization into class to prevent potential errors.
- Fix require errors when running wiki maintenance scripts.
- Cache the groups the user is a member of to save queries.
- Combine the group name lookups into one query.
What this means is that you can now run the scripts in the maintenance directory without receiving require errors. This is useful when upgrading mediawiki. You no longer need to comment out the extension in the LocalSettings.php file. Besides uploading the new extension you will need to change the require_once line that you added in LocalSettings.php.
# Load up the extension
require_once "$IP/extensions/Auth_SMF.php";
$wgAuth = new Auth_SMF();
For those that have multiple groups defined for $wgSMFGroupName and/or $wgSMFAdminGroupName I have decreased the number of database queries substantially. Before for each group name it have to make two queries. This caused extra load on the database server.
Now with no groups defined it will make 3 database queries (password check, partial ban check, group membership check) when loading a page. If you define $wgSMFGroupName it will only make one additional database query, and the same goes for $wgSMFAdminGroupName.
As always you can download the latest version from http://wgnrs.dynalias.com/smf/Auth_SMF.php
Thanks Ryan!
Would this work with a wiki and forum on separate servers or could it be made to work? I'm planning on moving my forum (but not my wiki) and so I'm looking for the best solution for this.
Quote from: Eliana Tamerin on April 18, 2008, 10:13:19 AM
Would this work with a wiki and forum on separate servers or could it be made to work? I'm planning on moving my forum (but not my wiki) and so I'm looking for the best solution for this.
It could be made to work. The only SMF file it uses is the Settings.php to grab the database details. I thought this would be easier for most to setup then having to supply the correct credentials.
All you would have to do is replace the following in the extension
if(file_exists("$IP/$wgSMFPath/Settings.php"))
require_once("$IP/$wgSMFPath/Settings.php");
else
die('Check to make sure $wgSMFPath is correctly set in LocalSettings.php!');
$smf_settings['boardurl'] = $boardurl;
$smf_settings['cookiename'] = $cookiename;
$smf_settings['db_server'] = $db_server;
$smf_settings['db_name'] = $db_name;
$smf_settings['db_user'] = $db_user;
$smf_settings['db_passwd'] = $db_passwd;
$smf_settings['db_prefix'] = $db_prefix;
with this
$smf_settings['boardurl'] = 'boardurl';
$smf_settings['cookiename'] = 'cookiename';
$smf_settings['db_server'] = 'server';
$smf_settings['db_name'] = 'database';
$smf_settings['db_user'] = 'username';
$smf_settings['db_passwd'] = 'password';
$smf_settings['db_prefix'] = 'prefix';
Just fill it in with the appropriate values from Settings.php. Granted the wiki server needs to have access to the mysql server hosting your SMF database. Most hosts don't allow outside access to the mysql server.
I have a question...
From reading this, it appears that if you want to allow guests to edit the wiki, then SMF users are not automatically logged in to the wiki when they visit. Is this the case?
The reason I'm asking is because I have had problems with the other two bridges. Because they use SSI.php, SMF attempts to sanitize the query strings from the wiki as well, which prevents you from using apostrophes (and possibly other characters) in article titles.
I found a workaround for now - pull the title before extensions are loaded, then set the title to the original value later on, bypassing all checks and such - but it creates some sort of an infinite loop if I use it on a subdomain.
I'm trying to find a solution that doesn't involve modifying SMF or hacking Mediawiki.
Quote from: Oldiesmann on May 11, 2008, 07:22:48 PM
From reading this, it appears that if you want to allow guests to edit the wiki, then SMF users are not automatically logged in to the wiki when they visit. Is this the case?
Nope that is not the case. The auto login will work whether or not guests can edit the wiki. The guest editing is defined by the below setting I suggest to add in LocalSettings.php
# This requires a user be logged into the wiki to make changes.
$wgGroupPermissions['*']['edit'] = false;
Quote from: Oldiesmann on May 11, 2008, 07:22:48 PM
The reason I'm asking is because I have had problems with the other two bridges. Because they use SSI.php, SMF attempts to sanitize the query strings from the wiki as well, which prevents you from using apostrophes (and possibly other characters) in article titles.
Mine doesn't use SSI.php. I tried using it and I can't remember the exact error message but I was having issues with the sessions conflicting. I only include the Settings.php file from SMF to grab the database values and SMF cookie name. Due to this you must being using database sessions in SMF and have the enable local storage of cookies option unchecked.
When I do the login redirect I destroy the MediaWiki session, load up the SMF session, set the old_url or logout_url value, update the sessions table, and redirect to the SMF page. This took a bit to figure out but it has been working great.
Quote from: Oldiesmann on May 11, 2008, 07:22:48 PM
I'm trying to find a solution that doesn't involve modifying SMF or hacking Mediawiki.
I would recommend trying my bridge out. It doesn't require modifying any SMF files. You just place the extension in the folder and add a few lines to LocalSettings.php.
I will definitely give this a try. Thanks!
Just switched to the new bridge and it works wonderfully. Thanks!
Quote from: Oldiesmann on May 12, 2008, 01:38:05 PM
Just switched to the new bridge and it works wonderfully. Thanks!
Glad to hear it worked for you!
Quote from: Slack on April 09, 2008, 04:11:12 PM
Sounds like the path to your forum is not correct, it cannot find your forum log out page - did you follow this example?
# Example: /public_html/forum and /public_html/wiki -> ../forum
$wgSMFPath = "../forum";
I understand this is relating to something else, but i keep getting this error
Check to make sure $wgSMFPath is correctly set in LocalSettings.php!
I follow the example but keep getting the same error, I'm not sure what i'm doing wrong here.
so i set up like this?
$wgSMFPath = "/webspace/httpdocs/forums";
or like this?
$wgSMFPath = "/webspace/httpdocs/forums and /webspace/httpdocs/mediawiki -> /webspace/httpdocs/forums";
both of these give me the same error.
Daff, try $wgSMFPath = "../forums";
Fantastic! From the first sight - works perfectly. ;-)
Is there a way to make wiki readable ONLY by registered user?
UPD: forget it, i've read manual.
Always glad to hear that it is working and my work has been appreciated!! Thanks!
Why don't you post your bridge to mediawiki Extensions?
Quote from: Bust_Ed on June 08, 2008, 03:49:47 PM
Why don't you post your bridge to mediawiki Extensions?
I already have
http://www.mediawiki.org/wiki/Extension:SMF_Auth_Integration
Aaaah, i know, why i've not noticed it... actually, i noticed, but "It has been tested on MediaWiki 1.11.1 through 1.12.0 and is compatible with SMF versions 1.1.x and 2.0.", and i've only 1.6 Wiki (php4).
Well, it's working on wiki 1.6, but one of my users says, that he can't login with his user|pass. I'm not sure, where problem, i'll ask other users and see, what they say tomorrow.
Well those versions are the ones I've tested it on. I wouldn't be surprised if it worked fine with previous version. Let me know how it goes.
Having some problem with user login. And can't track why some users can login, and others can't. Is there any log, which shows, why they have access denied?
Are there underscores or spaces in their usernames?
Yes, there was space and the name was in russian. I've changed it manually in BD to somewhat simple, like "UserName", but no luck again.
Underscores and spaces should be supported. MediaWiki will change underscores to spaces and I have a function that fixes that. That was why I was asking. Off the top my head I'm not sure where the issue is. You could try putting some echos in there or have it write out info to a text file to debug it. If I have time later I'll add some debug lines in a version.
Echoes in your code? Ok, i'll try.
OK, i've went through your file.
function authenticate( $username, $password ) {
.....
$pw = sha1(strtolower($username) . $password);
$file_name='/home/*/cat.txt'; // 1
$w=fopen($file_name,'w'); // 6
fwrite($w,$username);
fwrite($w," password ");
fwrite($w,$pw); // 7
fwrite($w," passwd ");
fwrite($w,$passwd);
fclose($w); // 8
// Check for password match, the user is not banned, and the user is allowed.
.....
}
I ONLY have info written to file (username, pw and passwd) if access is allowed. If i have denied access, then no info written. How can that be?
And second question, i've noticed some "auto auth" function. If i right, then if i'm logged to SMF and go to wiki - i should be auto allowed access to wiki. But that's not happening. Why?
I've found stuff regarding autologin. It's here
# NOTE: Make sure to configure the wgCookeDomain below
#$wgSMFLogin = true;
But if i uncomment this line, i'm getting this error:
Fatal error: Call to a member function on a non-object in /home/deralsem/data/www/whokilled.ru/wiki/extensions/Auth_SMF.php on line 235
It seems, that i've found some kind of bug... Most of my users are belong to post count based group, which i renamed in Russian language. They can't login, but error given is that they have bad password. I think, there should be another warning, like "Your group is not allowed to login".
Talking about something completely different, would it be possible to integrate SMF layout with mediawiki by using "Custom Action Mod"?
Quote from: Bust_Ed on June 10, 2008, 06:33:53 AM
I've found stuff regarding autologin. It's here
# NOTE: Make sure to configure the wgCookeDomain below
#$wgSMFLogin = true;
But if i uncomment this line, i'm getting this error:
Fatal error: Call to a member function on a non-object in /home/deralsem/data/www/whokilled.ru/wiki/extensions/Auth_SMF.php on line 235
Looks like auto-login is not supported on that version of mediawiki.
Quote from: Bust_Ed on June 10, 2008, 07:48:09 AM
It seems, that i've found some kind of bug... Most of my users are belong to post count based group, which i renamed in Russian language. They can't login, but error given is that they have bad password. I think, there should be another warning, like "Your group is not allowed to login".
The goal of my integration was to not modify the mediawiki files. I don't think that type of warning is possible without modifications to the source. I was going to let them login and restrict their editing, but that brought up a whole new complex issue with dealing with media wiki permissions and mapping them correctly.
That's OK, so just note somewhere in readme, that autlogin feature doesn't work with MW 1.6.
SO, at the moment, i need:
anonymous disabled read
members allowed read
special group + admins allowed write
Is that possible?
Awesome bridge , but i also need something for the theme
Thanks ;)
Quote from: NIBOGO on June 11, 2008, 06:28:26 PM
Awesome bridge , but i also need something for the theme
Thanks ;)
You'll have to modify an existing theme or create your own. I used the Kind of Blue theme, added my header to the top, and changed the colors. It wasn't much different then editing the SMF theme.
i use classic theme in my forum so i think no problem right to modified it
rsw686, what about my question?
Quote from: Bust_Ed on June 10, 2008, 09:55:57 AM
That's OK, so just note somewhere in readme, that autlogin feature doesn't work with MW 1.6.
SO, at the moment, i need:
anonymous disabled read
members allowed read
special group + admins allowed write
Is that possible?
Yeah I'm fairly sure that would be possible. It would take some changing with the mediawiki permissions. With my bridge you can assign admins and specific smf groups sysop privileges on media wiki. You would just need to configure * for guests to no read, logged in for read only, and sysop for read / write.
OK, i'll try to figure it out. Thanks for your support.
Great bridge - I can get it to work, but in my wiki template I use ssi to pull forum information to the left bar as you can see at http://off-the-grid.kiasworld.co.uk/
When i enable this bridge the ssi stops working - but you are logged into the wiki - any ideas?
Quote from: kiakanpa on July 01, 2008, 04:32:56 AM
Great bridge - I can get it to work, but in my wiki template I use ssi to pull forum information to the left bar as you can see at http://off-the-grid.kiasworld.co.uk/
When i enable this bridge the ssi stops working - but you are logged into the wiki - any ideas?
Not sure on that. I have never used the SSI functions. Why not make your left bar with PHP? You can use
<?php if($this->data['loggedin']==0) { ?>
to determine if the user is logged into the wiki. I use this to customize the menu on my wiki.
Thanks rsw686, but the left bar is made with php - It might seem a bit of a strange way at first - but the header, main menu, and left bar of the site are all includes that are used over the whole site (including smf forum, modx cms, mediawiki, and lifetype blog) - I have done this to make a consitant look/feel across the whole site while only having to maintain one template (i am currently working toward this - i will get there in the end >:()
Now, this included template is fine for all the other parts - but as the wiki was authenticating with this module (before my 'upgrade') - there seems to be an incompatiblity between the two - it is probably going to be something difficult to find like a shared variable name or something.
Has anyone else got this module to work with smf ssi also on the wiki page? anyone fancy trying it to see if its just me :P?
Quote from: kiakanpa on July 01, 2008, 08:03:50 AM
Has anyone else got this module to work with smf ssi also on the wiki page? anyone fancy trying it to see if its just me :P?
I tried, but had a similar problem. After reading some things about sessions in PHP, my conclusion is that it's impossible to use SSI with this bridge, since it creates 2 different sessions in the same page.
Although you can always use HTML above and below in the mediawiki index page to make it similar to SMF template ;)
hmmm... i might have a look at creating (yet another) bridge. I think it is possible to use mediawikis autoauth with smf's ssi - i'll have a look.
I see what you are trying to do. I was thinking apache SSI functions not the SMF SSI PHP functions. Yeah the problem is the two sessions. You could just poll the database directly and build your data. I tried getting MediaWiki to work with the SMF session and nothing would work right. It took a few hours just to get the auto authentication to work as I had to start up the SMF session and set the redirect URL.
Need a bit of help with this.
My wiki is installed at wiki.psnfriends.net
Forum is in root of psnfriends.net
So I think I need these variables
wgsmfpath = "..";
wgcookiedomain = ".psnfriends.net"
But I can't see where I change these variables? And have I even got them right? Is there any others I need to change?
Thanks for any help :)
Anyone?
Quote from: rsw686 on June 15, 2008, 09:33:37 AM
Quote from: Bust_Ed on June 10, 2008, 09:55:57 AM
That's OK, so just note somewhere in readme, that autlogin feature doesn't work with MW 1.6.
SO, at the moment, i need:
anonymous disabled read
members allowed read
special group + admins allowed write
Is that possible?
Yeah I'm fairly sure that would be possible. It would take some changing with the mediawiki permissions. With my bridge you can assign admins and specific smf groups sysop privileges on media wiki. You would just need to configure * for guests to no read, logged in for read only, and sysop for read / write.
I need to do something like this too.
$wgGroupPermissions['*']['edit'] = false; // MediaWiki Setting
$wgGroupPermissions['*']['read'] = false; // MediaWiki Setting
$wgSMFGroupName = array('GroupA', 'GroupB', 'GroupC', 'GroupD', 'GroupE', 'GroupF');
That's what I have right now. I need to make it so that GroupA - GroupE can write and GroupF can only read, but am not sure where to start! Thanks!
Quote from: Chris369 on July 08, 2008, 12:25:54 PM
Need a bit of help with this.
My wiki is installed at wiki.psnfriends.net
Forum is in root of psnfriends.net
So I think I need these variables
wgsmfpath = "..";
wgcookiedomain = ".psnfriends.net"
But I can't see where I change these variables? And have I even got them right? Is there any others I need to change?
Thanks for any help :)
Someone must be able to help me with this? :(
Ok - I have solved my problem without having to write another bridge. If anyone else wishes to use smf's SSI functions with this bridge all you need to do is remove the forums settings.php require from the top of the file & manually enter your smf details. Hope this helps others.
Quote from: kiakanpa on July 16, 2008, 04:38:30 AM
Ok - I have solved my problem without having to write another bridge. If anyone else wishes to use smf's SSI functions with this bridge all you need to do is remove the forums settings.php require from the top of the file & manually enter your smf details. Hope this helps others.
Does that influence security for any reason or not at all?
you dont remove the setting.php file - only the require function from the bridge. Adding the settings from settings.php into the Auth_smf.php should not be a security issue in itself as direct access to auth_smf.php will not reveal the settings - if you want to be really sure you could just disable access to the extentions folder through .htaccess - but i dont think this is needed.
"To get started you only need to configure the relative path to your SMF forum."
ok... is that really all I need to get started? I did that and it is not working...
I configured the relative path and the smf version, but when I try to login to the wiki it tells me no user with my name exists.
Quote from: Chris369 on July 08, 2008, 12:25:54 PM
Need a bit of help with this.
My wiki is installed at wiki.psnfriends.net
Forum is in root of psnfriends.net
So I think I need these variables
wgsmfpath = "..";
wgcookiedomain = ".psnfriends.net"
But I can't see where I change these variables? And have I even got them right? Is there any others I need to change?
Thanks for any help :)
Aynone?
Hello,
my Structure:
wiki at example.com (Path: /some/path/)
forum at forum.example.com (Path: /some/path/forum).
My Config:
$wgSMFPath = "forum";
$wgSMFVersion = "1.1";
$wgSMFLogin = true;
$wgCookieDomain = '.example.com';
SMF-Config:
Enable local storage of cookies [ ]
Use subdomain independent cookies [X]
Use database driven sessions [X]
My Software: Mediawiki: 1.12.0 & SMF 1.1.5
I'm not redirected back to the wiki after login and if i try to logout from the wiki, i get the error-message:
Session verification failed. Please try logging out and back in again, and then try again.
from SMF when trying to Logout from the wiki. When i logout manually in the forum, it works.
How can i solve this? Do i have to change $wgCookiePath or $wgCookieSecure? Perhaps i'm thining i a wrong way ;)
Please help me! Thanks in Advance!
Your config looks correct to me. Do you use Firefox? If so view the page info and look at the cookies set. See if the SMF cookie carries over to the wiki.
Alright, what am I missing here. I just did a completely vanilla install of MediaWiki, and put Auth_SMF (with options set) in the extensions folder.
http://www.fmvperformance.com/ = forum
http://www.fmvperformance.com/fmvarticles = wiki
It's not doing anything... ignoring the fact that auth_smf is even there.
drhamad:
The options don't get set in Auth_SMF.php. They need to be copied pasted into MediaWiki's LocalSettings.php file.
Quote from: rsw686 on August 11, 2008, 07:17:17 PM
drhamad:
The options don't get set in Auth_SMF.php. They need to be copied pasted into MediaWiki's LocalSettings.php file.
Oops, I'm blind. Thanks man.
Hey rsw, exactly where did you put your SMF header information in the MediaWiki template? I'm having a hard time understanding their code (just looking in MonoBook.php)... trying to do an include() to include something at the top.
Quote from: drhamad on August 12, 2008, 02:32:48 PM
Hey rsw, exactly where did you put your SMF header information in the MediaWiki template? I'm having a hard time understanding their code (just looking in MonoBook.php)... trying to do an include() to include something at the top.
Scroll down a bit in MonoBook.php. You'll see regular HTML with <?php ?> tags inside of it. Just add the header in there. I used the Kind Of Blue skin for MediaWiki as it fit my forum design better.
@ rsw686,
I've just updated mediawiki to 1.13 and the "AutoAuthenticate" hook stopped working.
Reading mediawiki's manual I found out that this hook is no longer supported in 1.13, being replaced by "UserLoadFromSession" instead. I then replaced the above expression by this one in Auth_SMF.php and the workaround seem to have solved the problem, but I'd like to know if further changes need to be made.
Quote from: Paracelsus on August 19, 2008, 08:11:27 AM
@ rsw686,
I've just updated mediawiki to 1.13 and the "AutoAuthenticate" hook stopped working.
Reading mediawiki's manual I found out that this hook is no longer supported in 1.13, being replaced by "UserLoadFromSession" instead. I then replaced the above expression by this one in Auth_SMF.php and the workaround seem to have solved the problem, but I'd like to know if further changes need to be made.
I will have to look into this. 1.13 must have been just released.
According to MediaWiki's website, it was released last Thursday.
I've been using an SVN copy of MediaWiki for a while now, but haven't upgraded for several months, so I guess the version I'm using doesn't have that change.
Ahh so close and yet...
I'm looking for a MediaWiki to SMF integration but I want to use the MediaWiki Database for the SMF user login.
We've hardly got any SMF members compared with the MediaWiki membership.
See http://theaquariumwiki.com/ for how we've added SMF to our Wiki.
Forum link is in the left upper panel.
Has any work been done with doing this type of integration?
I would have thought a MediaWiki -- SMF integration program for common user login would make SMF very popular with MediaWiki administrators? They seem to be crying out for one.
Comments?
That Mediawiki -> Forum interaction instead of Forum -> Mediawiki when it comes to members might be interesting.
One thing that I've just remembered and that would also be cool to add to the bridge:
- Put the talk/discussion pages directing to a new topic with the page name as subject and in a specified board. I've seen this integration in several wikis from "wikidot".
I am using SMF 1.1.6, and installed Mediawiki 1.6 (older version of PHP on the server that hosts me). I installed the bridge, copied the parts from it into the LocalSettings.php for the wiki.
My problem is that now when I try to access the wiki, I get this error:
Fatal error: Call to a member function on a non-object in /home/abavagad/public_html/parlame/wiki/extensions/Auth_SMF.php on line 279
I did not change any of the code.
lines 278-282 are:
278 // Only poll the database if no session or username mismatch.
279 if(!($user->isLoggedIn() && $user->getName() == $username))
280 {
281 $user->setName($username);
282 $user->setId($user->idForName());
Can anyone help me on this?
Sorry that version of MediaWiki is not supported. I've only used the 1.12 versions so I'm not sure even where to start.
Quote from: Abavagada on September 22, 2008, 09:33:21 AM
I am using SMF 1.1.6, and installed Mediawiki 1.6 (older version of PHP on the server that hosts me). I installed the bridge, copied the parts from it into the LocalSettings.php for the wiki.
My problem is that now when I try to access the wiki, I get this error:
Fatal error: Call to a member function on a non-object in /home/abavagad/public_html/parlame/wiki/extensions/Auth_SMF.php on line 279
I did not change any of the code.
lines 278-282 are:
278 // Only poll the database if no session or username mismatch.
279 if(!($user->isLoggedIn() && $user->getName() == $username))
280 {
281 $user->setName($username);
282 $user->setId($user->idForName());
Can anyone help me on this?
Put this as false instead in LocalSettings.php:
$wgSMFLogin = true;
Mediawiki 1.6 works with SMF but the autologin function doesn't, meaning that you have to login again to the wiki (but the member database integration work perfectly).
Thanks Paracelsus. That did the trick. :D
This bridge has worked like a charm for me. Thanks!
The only thing I'd comment on, and this is minor, is that if a permissions group specified in LocalSettings.php for edit access doesn't exist in SMF, the whole thing ceases to function. It'd be nice if that wasn't true, but not a big deal since you can just create the group or delete it from LocalSettings
Quote from: drhamad on September 30, 2008, 04:00:44 PM
The only thing I'd comment on, and this is minor, is that if a permissions group specified in LocalSettings.php for edit access doesn't exist in SMF, the whole thing ceases to function. It'd be nice if that wasn't true, but not a big deal since you can just create the group or delete it from LocalSettings
This was actually done on purpose. Otherwise you might not notice that the group name is invalid. I figured the group permissions weren't changed that often.
hoi!
i had a working mediawiki 1.13 in http://tarbatu.org (with some users), installed smf 1.1.4 http://tarbatu.org/koda , upgraded it to 1.1.6 and added bridge files to wiki/smf and to mediawiki's localsettings.php
Quote#### SMF Authentication
#Snakehit (snakehit (at) gmail.com)
# For all non-logged in users
$wgGroupPermissions['*']['createaccount'] = false; # This requires a user be logged into the wiki to make changes.
$wgGroupPermissions['*']['edit'] = false; # Specify who may create new accounts: 0 means no, 1 means yes
# Disable everything of caching, caching is boe for the login system.
$wgEnableParserCache = false;
$wgCachePages = false;
# Users can use the login function inside of the wiki to login.
$wgUseWikiLogin = false;
# This requires the link to SMF API.
$wgSMFPathAPI= "http://tarbatu.org/koda/smf_api.php"; # The smf_api.php file can be download from SMF website and must be placed in rootdir of your forum)
$wgSMFPathIndex= "http://tarbatu.org/koda/index.php"; # Full path to index.php file of SMF
// require the Auth_SMF.php
require_once 'http://tarbatu.org/extensions/Auth_SMF.php';
$wgAuth = new Auth_SMF();
?>
now i have working smf in http://tarbatu.org/koda but mediawiki gives blank screen in http://tarbatu.org - where did i mistake?
ps when i try to logout from smf, i get error:
QuoteFatal error: Class 'User' not found in /home/tarbatuo/public_html/koda/Sources/LogInOut.php on line 452
Your quoted mediawiki settings are not the ones for my bridge. I think you have mine confused with another smf mediawiki bridge. Also my bridge links mediawiki to smf's user table, not the other way around like you want to do.
is it impossible to use mediawiki-s users on smf?
so could mediawiki users have their userpages on mediawiki.
I'm having a problem where people (other than admins) cannot create a new mediawiki page. What permission controls this?
Thanks!
Quote from: rsw686 on August 19, 2008, 09:12:37 AM
Quote from: Paracelsus on August 19, 2008, 08:11:27 AM
@ rsw686,
I've just updated mediawiki to 1.13 and the "AutoAuthenticate" hook stopped working.
Reading mediawiki's manual I found out that this hook is no longer supported in 1.13, being replaced by "UserLoadFromSession" instead. I then replaced the above expression by this one in Auth_SMF.php and the workaround seem to have solved the problem, but I'd like to know if further changes need to be made.
I will have to look into this. 1.13 must have been just released.
Hi rsw686,
Can you try to address this question once more? I've made our wiki public and would like to know if the changes I did are good enough.
BTW, the wiki is in: www.forumscp.com/wiki and working perfectly so far. ;)
Quote from: Paracelsus on October 08, 2008, 02:34:17 PM
Hi rsw686,
Can you try to address this question once more? I've made our wiki public and would like to know if the changes I did are good enough.
BTW, the wiki is in: www.forumscp.com/wiki and working perfectly so far. ;)
I looked into this and actually updated my forum's wiki to the 1.13 version. The only change required is the one you suggested.
Quote from: rsw686 on October 08, 2008, 06:25:36 PM
Quote from: Paracelsus on October 08, 2008, 02:34:17 PM
Hi rsw686,
Can you try to address this question once more? I've made our wiki public and would like to know if the changes I did are good enough.
BTW, the wiki is in: www.forumscp.com/wiki and working perfectly so far. ;)
I looked into this and actually updated my forum's wiki to the 1.13 version. The only change required is the one you suggested.
Thanks. ;)
Quote from: drhamad on October 08, 2008, 12:15:02 AM
I'm having a problem where people (other than admins) cannot create a new mediawiki page. What permission controls this?
Thanks!
In addition to this, I was also wondering about a Deny permission. In other words, like in SMF, is there a permission that no matter if they have permission to edit in another group, they still won't be able to if they're in a Deny group?
Quote from: drhamad on October 10, 2008, 02:57:35 PM
Quote from: drhamad on October 08, 2008, 12:15:02 AM
I'm having a problem where people (other than admins) cannot create a new mediawiki page. What permission controls this?
Thanks!
In addition to this, I was also wondering about a Deny permission. In other words, like in SMF, is there a permission that no matter if they have permission to edit in another group, they still won't be able to if they're in a Deny group?
I think you can block the user using mediawiki's interface.
I installed Mediawiki 1.6 before, along with this bridge, to SMF 1.1.6. It worked fine. Today, I totally removed that version of mediawiki, and installed the most recent version, 1.13, and reinstalled this bridge. For some reason, I can't get the bridge to work. It will go to the login page of the forum correctly, but it isn't seeing any logins coming from the SMF, not even the admin. The only login it is accepting is the admin that was set up with the media wiki.
As far as I can tell, I made all the proper changes.. uploading the SMF_Auth file and copying the part of that into LocalSettings.php, and setting the paths.
Any idea on what I could be missing?
Quote from: Paracelsus on September 15, 2008, 10:41:08 AM
- Put the talk/discussion pages directing to a new topic with the page name as subject and in a specified board. I've seen this integration in several wikis from "wikidot".
I managed to do a part of it with this code in SkinTemplate.php. Basically, it creates a tab that links directly to a new topic with the wikipage title as the topic subject:
global $wgTitle ;
$content_actions['forum_section'] = array(
'class' => $section == 'new'?'selected':false,
'text' => "Discussão no Fórum",
'href' => 'http://www.xxxx.com/index.php?action=post;board=xxxx;subject='. str_replace("_", " ", $wgTitle->getDBkey())
);
The problem with this is that one can't see if the topic already exists (so that one would post a reply instead of a new topic). Any ideas to improve this?
Quote from: Abavagada on October 19, 2008, 05:58:22 PM
I installed Mediawiki 1.6 before, along with this bridge, to SMF 1.1.6. It worked fine. Today, I totally removed that version of mediawiki, and installed the most recent version, 1.13, and reinstalled this bridge. For some reason, I can't get the bridge to work. It will go to the login page of the forum correctly, but it isn't seeing any logins coming from the SMF, not even the admin. The only login it is accepting is the admin that was set up with the media wiki.
As far as I can tell, I made all the proper changes.. uploading the SMF_Auth file and copying the part of that into LocalSettings.php, and setting the paths.
Any idea on what I could be missing?
Never mind.. I just read Paracelsus's post on the previous page about the hook change, and that did the trick. Thanks.
Can someone running 1.13 explain exactly what they did to make the auto login thing work? I've replaced two instances of AutoAuthenticate with UserLoadFromSession and the wiki still treats me as a guest.
Quote from: Oldiesmann on October 27, 2008, 10:12:45 PM
Can someone running 1.13 explain exactly what they did to make the auto login thing work? I've replaced two instances of AutoAuthenticate with UserLoadFromSession and the wiki still treats me as a guest.
You only need to replace one instance of AuthAuthenticate in the Auth_SMF function.
Find this block of code
function Auth_SMF()
{
global $wgSMFLogin, $wgHooks;
// Integrate with SMF login / logout?
if(isset($wgSMFLogin) && $wgSMFLogin)
{
$wgHooks['AutoAuthenticateSMF'][] = 'AutoAuthenticateSMF';
$wgHooks['UserLoginForm'][] = 'UserLoginFormSMF';
$wgHooks['UserLogout'][] = 'UserLogoutSMF';
}
// Always redirect registration to SMF.
$wgHooks['UserCreateForm'][] = 'UserRegisterSMF';
// Connect to the database.
$this->connect();
}
Replace
$wgHooks['AutoAuthenticateSMF'][] = 'AutoAuthenticateSMF';
With
$wgHooks['UserLoadFromSession'][] = 'AutoAuthenticateSMF';
Ok. I must not have uploaded the file after I made the change. I fixed it now.
The other file I was editing was from a different SMF bridge.
I am getting a "Check to make sure $wgSMFPath is correctly set in LocalSettings.php!" What do I set it to when..
/public_html/forum and /public_html/folder1/wiki ?
Hi,
I was thinking about the issue of underscores in usernames. I could contact members with an underscore, and change their name to something else, and stop underscore being used in future signups. However, what about allowing underscore in usernames in Mediawiki? Can Mediawiki be addapted to allow underscores in user names without causing other problems? Or is this issue caused by something else?
My bridge deals with underscores in user names. Have a read through the comments in the bridge file for more information.
Maybe I've misunderstood something, but if Mediawiki was adapted to allow underscores in usernames, then wouldn't this resolve this issue, without any searching of the SMF username table for occurences of the same name with and without underscore? I'd prefer a solution that did not rely upon SMF usernames being changed. As it stands, it seems just a little untidy, and might be a pain for very large forums (not really an issue for me).
It is not the best solution, but are you going to patch the MediaWiki code each release? With the bridge my goal was to make it not require any modifications to either SMF or MediaWiki. What are the chances of having two members with the exact same forum username but with a space instead of an underscore?
I understand. I suppose it comes down to the size of the modification to Mediawiki. After all, I have numerous tweaks in SMF to maintain. If the change necessary to Mediawiki is minor, then this would seem the better way to go. I imagine that all would require is adding underscore to the list of allowed charactors to the Mediawiki registration.
When autologin is used, is it Mediawiki, or is it your code that removes the underscores?
I'll look at your code, as suggested in your previous post.
Quote from: Paracelsus on August 19, 2008, 08:11:27 AM
@ rsw686,
I've just updated mediawiki to 1.13 and the "AutoAuthenticate" hook stopped working.
Reading mediawiki's manual I found out that this hook is no longer supported in 1.13, being replaced by "UserLoadFromSession" instead. I then replaced the above expression by this one in Auth_SMF.php and the workaround seem to have solved the problem, but I'd like to know if further changes need to be made.
I was able to get MediaWiki 1.13 working by using this workaround. However, Even though I have correctly configured myself as being included in $wgSMFAdminGroupName, I am unable to do certain Sysop only capable functions, such as edit the Sidebar.
Has anyone else had this issue?
I have discovered, that I can't edit ANYTHING. Everything I try to edit, it says it lost the session data. It shows me logged in, I am able to access restricted pages, but I can't EDIT anything, because it loses track of the session data when I hit SAVE.
Help please!
Notice: Undefined variable: wgSMFPath in /home/thegta/public_html/wiki/extensions/Auth_SMF.php on line 124
Check to make sure $wgSMFPath is correctly set in LocalSettings.php!
whaaaaaaaaaa?
I've installed this bridge and I thankyou for the great work you've done.
I just have one problem which i'm finding it hard to solve.
Some of my forum users can login to the wiki without problems, but some others get the following error. I can't see any pattern as to which users can login ok and which can not.
One particular user with problems just has a password of four letters and two numbers, no special characters.
There was either an authentication database error or you are not allowed to update your external account.
Backtrace:
#0 /var/www/boulder/wiki/includes/specials/SpecialUserlogin.php(342): User->setPassword('mypassword')
#1 /var/www/boulder/wiki/includes/specials/SpecialUserlogin.php(486): LoginForm->initUser(Object(User), true)
#2 /var/www/boulder/wiki/includes/specials/SpecialUserlogin.php(392): LoginForm->attemptAutoCreate(Object(User))
#3 /var/www/boulder/wiki/includes/specials/SpecialUserlogin.php(493): LoginForm->authenticateUserData()
#4 /var/www/boulder/wiki/includes/specials/SpecialUserlogin.php(102): LoginForm->processLogin()
#5 /var/www/boulder/wiki/includes/specials/SpecialUserlogin.php(17): LoginForm->execute()
#6 [internal function]: wfSpecialUserlogin(NULL, Object(SpecialPage))
#7 /var/www/boulder/wiki/includes/SpecialPage.php(748): call_user_func('wfSpecialUserlo...', NULL, Object(SpecialPage))
#8 /var/www/boulder/wiki/includes/SpecialPage.php(534): SpecialPage->execute(NULL)
#9 /var/www/boulder/wiki/includes/Wiki.php(224): SpecialPage::executePath(Object(Title))
#10 /var/www/boulder/wiki/includes/Wiki.php(55): MediaWiki->initializeSpecialCases(Object(Title), Object(OutputPage), Object(WebRequest))
#11 /var/www/boulder/wiki/index.php(93): MediaWiki->initialize(Object(Title), NULL, Object(OutputPage), Object(User), Object(WebRequest))
#12 {main}
I had problems just with those with strange symbols in their nicknames (like -, á, à, â, ã), but otherwise no problems at all.
I'm running this on 1.1.8 right now and it works well. However, we're on the cusp of switching to 2.0... has this been tested at all with it?
I followed all the steps, and it didn't work. The only miracle that this did for me was screw up the login files, on 2 separate test forums. I'm now running 2B4, can someone do this for me please?
This Works Perfect, Thank you very much for an Awesome Script.
Ok quick question, is there a way to make MediaWiki Import Users from the SMF Dbase?
Not until that user logs into the wiki page is the user's SMF account imported and added to MW's database.
Quote from: Eliana Tamerin on April 13, 2009, 08:54:42 PM
Not until that user logs into the wiki page is the user's SMF account imported and added to MW's database.
Then it is failing to Import for me. What am I doing wrong?
Hi! I have a problem very similar to Bork's problem.
The message says:
#0 /home/motiona/public_html/wiki/includes/specials/SpecialUserlogin.php(348): User->setPassword('the_password')
#1 /home/motiona/public_html/wiki/includes/specials/SpecialUserlogin.php(513): LoginForm->initUser(Object(User), true)
#2 /home/motiona/public_html/wiki/includes/specials/SpecialUserlogin.php(418): LoginForm->attemptAutoCreate(Object(User))
#3 /home/motiona/public_html/wiki/includes/specials/SpecialUserlogin.php(520): LoginForm->authenticateUserData()
#4 /home/motiona/public_html/wiki/includes/specials/SpecialUserlogin.php(103): LoginForm->processLogin()
#5 /home/motiona/public_html/wiki/includes/specials/SpecialUserlogin.php(17): LoginForm->execute()
#6 /home/motiona/public_html/wiki/includes/SpecialPage.php(749): wfSpecialUserlogin(NULL, Object(SpecialPage))
#7 /home/motiona/public_html/wiki/includes/SpecialPage.php(539): SpecialPage->execute('wfSpecialUserlo...', NULL, Object(SpecialPage))
#8 /home/motiona/public_html/wiki/includes/Wiki.php(226): SpecialPage::executePath(NULL)
#9 /home/motiona/public_html/wiki/includes/Wiki.php(59): MediaWiki->initializeSpecialCases(Object(Title))
#10 /home/motiona/public_html/wiki/index.php(114): MediaWiki->initialize(Object(Title), Object(OutputPage), Object(WebRequest))
#11 {main}
I'm waiting for an answer :D, because I want to use MediaWiki :)
Thank you very much and good luck!
News?
Does this bridge work with SMF2.0b4 - MW 1.14? :)
Nice Bridge, (read the whole thread tree or mor time, all ok, UserLoadFromSession changed)
My question:
How should I wrote the cookiepath and Relative path to the forum directory from the wiki ?
All work fine Mediawiki 1.12 SMF 1.1.9
I will try Mediawiki 1.13.5
Does this work with SMF 2.0?
SMF 1.1.9
MW 1.12, 1.13.5, 1.14
Works well, no issues found.
Thanks. What is the real difference between this and SMF_Auto_Authentication on the MW side? From its general summary, it seems to do the same thing, i havent heard of any issues?
Does this one fix the underscore issue?
Does this work with SMF 2.0?!
It's difficult for me to answer in English, I will quote the autors mod, better for you, for me and for Shakespeare. ;)
Quote from: Saleem on June 03, 2009, 04:33:02 PM
Thanks. What is the real difference between this and SMF_Auto_Authentication on the MW side? From its general summary, it seems to do the same thing, i havent heard of any issues?
What's better with this Mod already explain in the first message in this topic:
QuoteThe 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. 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.
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.
Quote from: Saleem on June 03, 2009, 04:33:02 PM
Does this one fix the underscore issue?
From the author, first message:
QuoteThe bridge also supports SMF usernames with underscores. MediaWiki converts underscores to spaces which causes authentication problems with almost all other bridges. I developed a work around by checking for the first registered SMF username with spaces or underscores. It is very unlikely that two SMF users will have the same name like john_smith and john smith. If they do you'll need to change the username of the later registered SMF user.
Quote from: lorenzone92 on June 03, 2009, 05:34:46 PM
Does this work with SMF 2.0?!
I don't have tested with SMF2 but it should normally work.
For using it with Mw 1.13 or 1.14 you should do this little modification: http://www.simplemachines.org/community/index.php?topic=221622.msg1771668#msg1771668
I'm trying to get this working with SMF 2.0 RC1-1 and MediaWiki 1.15. It appears that everything is working fine with one exception. When I try and logout it gives the following error:
"Session verification failed. Please try logging out and back in again, and then try again."
My directory structure:
Forum: http://www.mysite.com/forums
Wiki: http://www.mysite.com/w (note that I'm using the short url method (http://www.mediawiki.org/wiki/Manual:Short_URL) on the wiki media site)
Enable local storage of cookies: Unchecked
Use subdomain independent cookies: Unchecked
Use database driven sessions: Checked
If you need me to post other information please just ask. I would love to get this working.
Any help is greatly appreciated.
With short url I have some issue, MW 1.1.4 and SMF 1.1.9.K "Session Verification Failed" when I want edit a page.
Have you guys checked the "hook" issue that need changing posted on the last pages?
Quote from: Paracelsus on July 13, 2009, 05:31:45 AM
Have you guys checked the "hook" issue that need changing posted on the last pages?
If you're referring to the AutoAuthenticate to UserLoadFromSession hook changes then yes I've already made that change.
Hello! Sorry for bad English :)
When I try to log in, wiki redirects me to SMF. But after registration I remain at a forum.
At hand-held input of wiki address the system still considers me as the anonymous.
May you help?
forum: rpgaliance.ru (http://rpgaliance.ru)
wiki: imperial.rpgaliance.ru (http://imperial.rpgaliance.ru)
LocalSettings.php:
$wgSMFPath = "../../public_html";
$wgSMFVersion = "1.1";
$wgSMFLogin = true;
$wgCookieDomain = '.rpgaliance.ru';
Thanks!
As this is an unofficial bridge, I'm going to mark this as solved to remove it from our support queue
great bridge, looks sooo much better then the other ones. i am getting this error though:
Notice: Undefined index: wgSMF_UseExtDatabase in /home/******/public_html/wiki/extensions/Auth_SMF.php on line 195
Notice: Undefined index: wgSMF_UserTB in /home/^^^^^/public_html/wiki/extensions/Auth_SMF.php on line 275
Unable to view external table
MySQL Error Number: 1103
MySQL Error Message: Incorrect table name ''
any help would be appreciated, this would be super cool awesome if i could get it to work (btw, my site is gameopp.com)
Oh great, I'm getting dizzy just from looking at the code.
As you might have guessed, I have no knowledge regarding PHP, so I don't understand anything of this. However, I really would like to be able to use this mod. It would help my community greatly.
So, could I get a step by step, simple walkthrough? I know it may be a lot to ask for, but it really, really would help me.
Other than that, I'm just wondering if this still works with smf 1.10
http://www.mediawiki.org/wiki/Extension:SMF_Auth_Integration
1) Install the forum (for example we'll use www.example.com/forum/)
2) Install mediawiki (ex: www.example.com/wiki/)
3) put the .php file in wiki/extensions/ directory
4) add below code to wiki/localsettings.php
# This requires a user be logged into the wiki to make changes.
$wgGroupPermissions['*']['edit'] = false; // MediaWiki Setting
# If you experience the issue where you appear to be logged in
# even though you are logged out then disable the page cache.
#$wgEnableParserCache = false;
#$wgCachePages = false;
# SMF Authentication
# To get started you only need to configure wgSMFPath and wgSMFVersion.
# The rest of the settings are optional for advanced features.
# Relative path to the forum directory from the wiki
# Do not put a trailing /
# Example: /public_html/forum and /public_html/wiki -> ../forum
$wgSMFPath = "../forum";
# Set to the version of SMF you are using.
$wgSMFVersion = "1.1";
#$wgSMFVersion = "2.0";
# Use SMF's login system to automatically log you in/out of the wiki
# This will only work if you are using SMF database sessions (default).
# Make sure "Use database driven sessions" is checked in the
# SMF Admin -> Server Settings -> Feature Configuration section
# NOTE: Make sure to configure the wgCookeDomain below
#$wgSMFLogin = true;
# Make "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.org';
#$wgCookiePath = '/'; // Optional, defaults to '/'
#$wgCookieSecure = false; // Optional, only change on scheme mismatch
# Require members to be a part of this SMF group(s) to login
# NOTE: Members of the SMF Administrator group are always able to login
#$wgSMFGroupName = 'Wiki Editor';
#$wgSMFGroupName = array('Wiki Editor', 'Global Moderator');
# Grant members of this SMF group(s) wiki sysop privileges
# NOTE: These members must be able to login to the wiki
#$wgSMFAdminGroupName = 'Wiki Admin';
#$wgSMFAdminGroupName = array('Wiki Admin', 'Global Moderator');
# Load up the extension
require_once "$IP/extensions/Auth_SMF.php";
$wgAuth = new Auth_SMF();
5) Since you're likely going to be running mediawiki 1.14, youll need to find the below code in the .php file you put in wiki/extensions/
$wgHooks['AutoAuthenticate'][] = 'AutoAuthenticateSMF';
Replace the above code with the below code:
$wgHooks['UserLoadFromSession'][] = 'AutoAuthenticateSMF';
6) Open up localsettings and edit the settings you added as needed.
When I try to logout from the wiki I receive a "session verification" error!! :(
How can I fix this?
Thanks in advance!
Im having issues with this using SMF 1.1.10 and Mediawiki 1.15.1.
I made all the necessary changes to Auth_SMF.php for the 1.13 and up adjustment: $wgHooks['UserLoadFromSession'][] = 'AutoAuthenticateSMF';
The problem im getting is the following Mediawiki error:
Original exception: exception 'MWException' with message 'Detected bug in an extension! Hook AutoAuthenticateSMF failed to return a value; should return true to continue hook processing or false to abort.' in ...<sanitized>.../includes/Hooks.php:137
Now if I change the value in Auth_SMF.php back to $wgHooks['AutoAuthenticate'][] = 'AutoAuthenticateSMF';
, the Wiki loads, however new users of the forum who dont already have an account on the wiki cant do anything, tells them to login.
Now my forum and my wiki are located on different sub-domains if this has any impact, idk.
Also, I should add that this was working perfectly until I upgraded to PHP 5.3.0, so im not sure if perhaps thats affecting it as well.
Any help here would be appreciated.
Quote from: Sinistercat on September 11, 2009, 07:24:50 AM
Im having issues with this using SMF 1.1.10 and Mediawiki 1.15.1.
I made all the necessary changes to Auth_SMF.php for the 1.13 and up adjustment: $wgHooks['UserLoadFromSession'][] = 'AutoAuthenticateSMF';
The problem im getting is the following Mediawiki error:
Original exception: exception 'MWException' with message 'Detected bug in an extension! Hook AutoAuthenticateSMF failed to return a value; should return true to continue hook processing or false to abort.' in ...<sanitized>.../includes/Hooks.php:137
Now if I change the value in Auth_SMF.php back to $wgHooks['AutoAuthenticate'][] = 'AutoAuthenticateSMF';
, the Wiki loads, however new users of the forum who dont already have an account on the wiki cant do anything, tells them to login.
Now my forum and my wiki are located on different sub-domains if this has any impact, idk.
Also, I should add that this was working perfectly until I upgraded to PHP 5.3.0, so im not sure if perhaps thats affecting it as well.
Any help here would be appreciated.
It looks like you have to add a "
return true;" somewhere in one of those files for the AutoAuthenticate function. I can't help more I'm not a programmer, but you can go for the try and error approach. ;D
Actually, I found this topic describing a similar error in IpbWiki that also occurs after upgrading to PHP 5.3.0:
http://www.ipbwiki.com/forums/index.php?showtopic=2894
Perhaps it can help you. ;)
I fixed the issue. In case anyone else has this problem its a simple fix.
Find:
183: function AutoAuthenticateSMF(&$user) {
Replace with:
183: function AutoAuthenticateSMF($user) {
just remove the "&" in front of $user as well as make the nessisary 1.13 > change of "UserLoadFromSession" and it should work fine.
I'm not sure what to put here:
# Relative path to the forum directory from the wiki
# Do not put a trailing /
# Example: /public_html/forum and /public_html/wiki -> ../forum
$wgSMFPath = "";
My wiki is installed at public_html/wiki and my forum is installed at the root. I'm not sure what to put as the "relative path from the wiki". Any help appreciated.
I put "public_html" but got an error.
- I've noticed this question has been asked several times in this thread w/out an answer. From the way the instructions are written, it looks like it may be impossible to set up this mod with MediaWiki installed at a lower directory than SMF?
Quote from: choloman05 on October 04, 2009, 11:57:59 PM
I'm not sure what to put here:
# Relative path to the forum directory from the wiki
# Do not put a trailing /
# Example: /public_html/forum and /public_html/wiki -> ../forum
$wgSMFPath = "";
My wiki is installed at public_html/wiki and my forum is installed at the root. I'm not sure what to put as the "relative path from the wiki". Any help appreciated.
I put "public_html" but got an error.
- I've noticed this question has been asked several times in this thread w/out an answer. From the way the instructions are written, it looks like it may be impossible to set up this mod with MediaWiki installed at a lower directory than SMF?
it should be ".." (two dots, which mean "the directory above"). but i haven't really followed the discussion.
Thank you Gika, that seems to have worked.
Awesome work, didn't expect it to be that easy to set up.
I however like some before me posted as well can't get the unified log in/out working , I applied both the UserLoadFromSession hook change and I removed the & before the parameter of AutoAuthenticateSMF as suggested by SinisterCat. Both however to no avail.
Running Mediawiki 1.15.1 and SMF RC 2.1. With the wiki and forum on different subdomains (forums.domain.com / wiki.domain.com). Tried setting #wgCookieDomain to both forums.domain.com (seemed logical) and .domain.com (comment above the variable seems to suggest to do so).
Logout doesn't work because the logout format has changed. Go to the UserLogoutSMF function and switch these lines:
//smf_redirectWrapper('logout_url', 'logout;sesc=' . $_SESSION['rand_code']);
smf_redirectWrapper('logout_url', "logout;{$_SESSION['session_var']}={$_SESSION['session_value']}");
Also, you may want to invalidate the wiki cookies when the SMF user has logout. Add this 'else' to the AutoAuthenticateSMF function, at the first conditional:
if (isset($_COOKIE[$smf_settings['cookiename']]))
{
[/SNIP]
}
else {
// Remove cookies and session
$_COOKIE = array();
if (session_id() != '') {
session_destroy();
}
}
I got this working perfectly with version 1.15.1 of MediaWiki.
My complete script can be found here:
[http] pastebin.com [slash] f392b875f
Quote from: johanbcn on November 08, 2009, 03:55:36 PM
Logout doesn't work because the logout format has changed. Go to the UserLogoutSMF function and switch these lines:
I've integrated MW and SMF with this bridge, also calling the template_header function (SSI.php)...
the only problem I have is that login/logout doesn't work from the header (login box and logout button...) but the logout works if I click the logout button at the top of the screen (appears when a user is logged in..) can you help me..?
does this work if i use wiki for a subdomain and forums for a /forum/ extension?
if so then what will i need to know?
ok yea now i screwed the pooch here (my board and my wiki both have stopped working)
http://wiki.torous1234.co.cc/ ---> wiki
http://www.torous1234.co.cc/forum/ ----> smf forum
please please help
as i have no idea what went wrong
In need of some help please :) When I set $wgSMFLogin = false; it works fine but doesn't login to both wiki and forum. When $wgSMFLogin = true; it ONLY logs in to the forum and redirects to forum mainpage when login is clicked from wiki.
The URLS are:
hxxp://www.scottletts.com/erc/smftest/index.php
hxxp://www.scottletts.com/erc/wiki/
Sample login details
User: testuser
Pass: pass123
My LocalSettings are
# This requires a user be logged into the wiki to make changes.
$wgGroupPermissions['*']['edit'] = false; // MediaWiki Setting
# If you experience the issue where you appear to be logged in
# eventhough you are logged out then disable the page cache.
#$wgEnableParserCache = false;
$wgCachePages = false;
# SMF Authentication
# To get started you only need to configure wgSMFPath and wgSMFVersion.
# The rest of the settings are optional for advanced features.
# Relative path to the forum directory from the wiki
# Do not put a trailing /
# Example: /public_html/forum and /public_html/wiki -> ../forum
$wgSMFPath = "../smftest";
# Set to the version of SMF you are using.
#$wgSMFVersion = "1.1";
$wgSMFVersion = "2.0";
# Use SMF's login system to automatically log you in/out of the wiki
# This will only work if you are using SMF database sessions (default).
# Make sure "Use database driven sessions" is checked in the
# SMF Admin -> Server Settings -> Feature Configuration section
# NOTE: Make sure to configure the wgCookeDomain below
$wgSMFLogin = true;
# Make "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.scottletts.com';
#$wgCookiePath = '/'; // Optional, defaults to '/'
#$wgCookieSecure = false; // Optional, only change on scheme mismatch
# Require members to be a part of this SMF group(s) to login
# NOTE: Members of the SMF Administrator group are always able to login
#$wgSMFGroupName = 'Wiki Editor';
#$wgSMFGroupName = array('Wiki Editor', 'Global Moderator');
# Grant members of this SMF group(s) wiki sysop privileges
# NOTE: These members must be able to login to the wiki
#$wgSMFAdminGroupName = 'Wiki Admin';
#$wgSMFAdminGroupName = array('Wiki Admin', 'Global Moderator');
# Load up the extension
require_once "$IP/extensions/Auth_SMF.php";
$wgAuth = new Auth_SMF();
What am I doing wrong? :/
Quote from: sletts02 on December 14, 2009, 07:14:10 PM
In need of some help please :) When I set $wgSMFLogin = false; it works fine but doesn't login to both wiki and forum. When $wgSMFLogin = true; it ONLY logs in to the forum and redirects to forum mainpage when login is clicked from wiki.
(...)
What am I doing wrong? :/
Nothing, it is supposed to work that way.
Quote from: Paracelsus on December 15, 2009, 07:24:05 AM
Quote from: sletts02 on December 14, 2009, 07:14:10 PM
In need of some help please :) When I set $wgSMFLogin = false; it works fine but doesn't login to both wiki and forum. When $wgSMFLogin = true; it ONLY logs in to the forum and redirects to forum mainpage when login is clicked from wiki.
(...)
What am I doing wrong? :/
Nothing, it is supposed to work that way.
Huh? Isn't that a bit pointless then?
Is there anyway to it so;
If a user clicks login on the wiki, it redirects them to the forum login, logs them in to BOTH? At the moment there is no way to login to the wiki....
Quote from: sletts02 on December 15, 2009, 04:47:47 PM
Quote from: Paracelsus on December 15, 2009, 07:24:05 AM
Quote from: sletts02 on December 14, 2009, 07:14:10 PM
In need of some help please :) When I set $wgSMFLogin = false; it works fine but doesn't login to both wiki and forum. When $wgSMFLogin = true; it ONLY logs in to the forum and redirects to forum mainpage when login is clicked from wiki.
(...)
What am I doing wrong? :/
Nothing, it is supposed to work that way.
Huh? Isn't that a bit pointless then?
Is there anyway to it so;
If a user clicks login on the wiki, it redirects them to the forum login, logs them in to BOTH? At the moment there is no way to login to the wiki....
Oh ok, I thought you were just saying that, to log in, you had to do it in the forum and not in the wiki (but of course once you did it you would be logged in both).
Check the other bridge options, specially this one:
# Make "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
Question on how this bridge functions: I'm interested in porting an existing wiki to use the SMF - mediawiki bridge. some users have accounts on both, but may not match username or password.
Does it use the forum ID_MEMBER in the wiki tables?
or does the bridge insert new rows into the wiki_users table? and use a new member id created by the insertion to the wiki_users table?
If the username matches a wiki user, and the passwords match, does the bridge log that person in without creating a new user?
I'll need to manually update the wiki tables to cross-reference the correct user id numbers after migrating to this bridge.
Thanks,
Dave
any ideas to my above post (in a need to get this fixed asap)
Hey.
Just a few comments and questions. I tried using your bridge, and it worked perfectly for existing members. However, when new members tried to sign up, they could get into the Forum, but not into the Wiki. On inspection of the database, the members did not show up in the wiki users tables. Is there a fix for this? Or something you can suggest?
My forum is in folder: www/wl/forum
My wiki is in folder: www/wl/wiki
The forum is accessed from: forum.mysite.com
The wiki is access from: wiki.mysite.com
Thanks :)
Jayden
Ok. I've been doing some playing and I have narrowed it down. It's anyone with a non-ASCII letter in their name. We have members called "hashi", "taydr", "maggy" etc and they all work fine, but members with names like "jökull", "renaçido" and "nendûr" have problems logging into the wiki with the bridge running.
Can you suggest a work around? At the moment I'm getting them to recreate accounts which isn't really ideal.
Edit: I thought it might be relevant that the wiki reports an incorrect password, so I have an idea it might be an issue with non-ASCII letters when it comes to sha1'ing the password?
Thanks
Jayden
Quote from: hashi on January 24, 2010, 09:40:18 PM
Ok. I've been doing some playing and I have narrowed it down. It's anyone with a non-ASCII letter in their name. We have members called "hashi", "taydr", "maggy" etc and they all work fine, but members with names like "jökull", "renaçido" and "nendûr" have problems logging into the wiki with the bridge running.
Can you suggest a work around? At the moment I'm getting them to recreate accounts which isn't really ideal.
Edit: I thought it might be relevant that the wiki reports an incorrect password, so I have an idea it might be an issue with non-ASCII letters when it comes to sha1'ing the password?
Thanks
Jayden
I had the same problem from the beginning. Have no solution so the only thing I do is to ask the user to change the username (the nickname that shows up in the forum can stay unchanged).
Quote from: Paracelsus on January 25, 2010, 03:36:22 AM
Quote from: hashi on January 24, 2010, 09:40:18 PM
Ok. I've been doing some playing and I have narrowed it down. It's anyone with a non-ASCII letter in their name. We have members called "hashi", "taydr", "maggy" etc and they all work fine, but members with names like "jökull", "renaçido" and "nendûr" have problems logging into the wiki with the bridge running.
Can you suggest a work around? At the moment I'm getting them to recreate accounts which isn't really ideal.
Edit: I thought it might be relevant that the wiki reports an incorrect password, so I have an idea it might be an issue with non-ASCII letters when it comes to sha1'ing the password?
Thanks
Jayden
I had the same problem from the beginning. Have no solution so the only thing I do is to ask the user to change the username (the nickname that shows up in the forum can stay unchanged).
Yeah, thats what I'm having to get my members to do and they aren't happy. Maybe someone needs to give the OP a nudge here? :P
It may be that a non-ASCII support is missing when authenticating SMF usernames. On this I found that his expression:
utf8_decode($username)
is used on some mediawiki extensions to go over the non-ascii problem as in IP board-mediawiki bridge:
http://www.ipbwiki.com/forums/index.php?showtopic=4712
I noticed that Auth_SMF.php used to bridge SMF to mediawiki doesn't have any kind of reference to this... maybe the answer lies here, I don't know, it is just a guess.
Quote from: hashi on January 25, 2010, 05:12:45 AM
Yeah, thats what I'm having to get my members to do and they aren't happy. Maybe someone needs to give the OP a nudge here? :P
I'm assuming you did the UTF8 conversion on your forum? I never designed the bridge with UTF8 support as I used SMF with the default Latin1 encoding. If you look at the MediaWiki users table you will see that it was designed with Latin1 encoding as well. Unfortunately due to the lack of development on SMF 2 I converted my forum to vBulletin a year ago and no longer use the bridge. The great thing about PHP is the source code is in plain view. Feel free to modify it to work on your site.
Quote from: sletts02 on December 14, 2009, 07:14:10 PM
In need of some help please :) When I set $wgSMFLogin = false; it works fine but doesn't login to both wiki and forum. When $wgSMFLogin = true; it ONLY logs in to the forum and redirects to forum mainpage when login is clicked from wiki.
That is how it was designed. When wgSMFLogin = false SMF and MediaWiki each user their own authentication systems. When you log into one, you are not logged into the other. When you set wgSMFLogin = true I redirect the login to SMF and MediaWiki uses the SMF cookies to validate the login. If after logging into SMF your aren't logged into MediaWiki automatically check your cookie configuration. You need to have the cookies configured correctly for MediaWiki to see the SMF cookie.
Quote from: rsw686 on January 27, 2010, 12:06:45 AM
Quote from: hashi on January 25, 2010, 05:12:45 AM
Yeah, thats what I'm having to get my members to do and they aren't happy. Maybe someone needs to give the OP a nudge here? :P
I'm assuming you did the UTF8 conversion on your forum? I never designed the bridge with UTF8 support as I used SMF with the default Latin1 encoding. If you look at the MediaWiki users table you will see that it was designed with Latin1 encoding as well. Unfortunately due to the lack of development on SMF 2 I converted my forum to vBulletin a year ago and no longer use the bridge. The great thing about PHP is the source code is in plain view. Feel free to modify it to work on your site.
Clearly I don't understand the code used and nor do I have the time to be sifting through it playing with it. Surely you must know enough to be able to assist in what is probably a very quick fix?
Quote from: hashi on January 27, 2010, 01:44:37 AM
Clearly I don't understand the code used and nor do I have the time to be sifting through it playing with it. Surely you must know enough to be able to assist in what is probably a very quick fix?
And I have the time to be working on something that I don't even use now? I would have to setup a test database for SMF and MediaWiki, upload the files, and configure both applications. Then I need to configure the bridge, work on a fix, and test. That will take at least 2 hours of my time. I was nice enough to contribute a free bridge that I wrote for my site to address shortcomings in others. In return I get demanded to add features. You didn't even answer my question of if your forum was converted to UTF8 support.
Quote from: rsw686 on January 27, 2010, 08:25:42 AM
Quote from: hashi on January 27, 2010, 01:44:37 AM
Clearly I don't understand the code used and nor do I have the time to be sifting through it playing with it. Surely you must know enough to be able to assist in what is probably a very quick fix?
And I have the time to be working on something that I don't even use now? I would have to setup a test database for SMF and MediaWiki, upload the files, and configure both applications. Then I need to configure the bridge, work on a fix, and test. That will take at least 2 hours of my time. I was nice enough to contribute a free bridge that I wrote for my site to address shortcomings in others. In return I get demanded to add features. You didn't even answer my question of if your forum was converted to UTF8 support.
Yes it was. Most people would at least mention in their original post when they're no longer supporting it so that at least people won't download it, or bother posting about problems.
I managed to play with it enough to get the members to login without too much issue, however I seem to have troubles setting their permissions because they all get set as sysops :S
Quote from: hashi on January 27, 2010, 01:34:01 PM
Yes it was. Most people would at least mention in their original post when they're no longer supporting it so that at least people won't download it, or bother posting about problems.
That post was over two years ago and I really didn't think to go back and edit it. There hasn't been any major bugs in the bridge. What you are asking for is a feature request for UTF8 support.
Quote from: rsw686 on January 27, 2010, 02:21:33 PM
Quote from: hashi on January 27, 2010, 01:34:01 PM
Yes it was. Most people would at least mention in their original post when they're no longer supporting it so that at least people won't download it, or bother posting about problems.
That post was over two years ago and I really didn't think to go back and edit it. There hasn't been any major bugs in the bridge. What you are asking for is a feature request for UTF8 support.
Why are you trying to argue with me what I'm requesting or not... it's pointless. You've already said you're not willing to help in the slightest, so update your original post to let people know you can't help with issues anymore and be done with it.
Maybe a team member can take & continue the project... I think it's a really interesting bridge, that can be useful for a lot of people! ;)
What about any help on my question?
Quote from: Sir-Uli on July 26, 2008, 07:28:31 PM
I'm not redirected back to the wiki after login and if i try to logout from the wiki, i get the error-message:
Session verification failed. Please try logging out and back in again, and then try again.
from SMF when trying to Logout from the wiki. When i logout manually in the forum, it works.
Really the same here... :(
Same config:
Enable local storage of cookies [ ]
Use subdomain independent cookies [X]
Use database driven sessions [X]But I've MW 1.15.1 and SMF 2.0RC2...
Looks nice! Although I can't understand wiki markup and the wiki stuff, so I won't be having one...
Quote from: rsw686 on January 27, 2010, 08:25:42 AM
Quote from: hashi on January 27, 2010, 01:44:37 AM
Clearly I don't understand the code used and nor do I have the time to be sifting through it playing with it. Surely you must know enough to be able to assist in what is probably a very quick fix?
And I have the time to be working on something that I don't even use now? I would have to setup a test database for SMF and MediaWiki, upload the files, and configure both applications. Then I need to configure the bridge, work on a fix, and test. That will take at least 2 hours of my time. I was nice enough to contribute a free bridge that I wrote for my site to address shortcomings in others. In return I get demanded to add features. You didn't even answer my question of if your forum was converted to UTF8 support.
Ryan,
Just a quick note to let you know that I, for one, appreciate your contribution of the bridge. I noticed your site had converted to vB and suspected you might be no longer supporting the bridge. Like others, I hope someone will pick up your efforts and keep the SMF <--> MediaWiki bridge viable, though I do understand the concern about lack of progress on SMF 2.0.
Thanks again!
The "session verification failed" issue is due to a change in how SMF handles sessions. It now uses a randomly-generated session variable instead of "sesc", which is more secure. Try this and see if it fixes the error...
Open up Auth_SMF.php
Find
smf_redirectWrapper('logout_url', 'logout;sesc=' . $_SESSION['rand_code']);
Replace
smf_redirectWrapper('logout_url', 'logout;' . $_SESSION['session_var'] . '=' . $_SESSION['rand_code']);
Oldiesmann in my Auth_SMF.php if I search that line I find only:
function UserLogoutSMF(&$user) {
smf_sessionSetup();
//smf_redirectWrapper('logout_url', 'logout;sesc=' . $_SESSION['rand_code']);
smf_redirectWrapper('logout_url', "logout;{$_SESSION['session_var']}={$_SESSION['session_value']}");
}
But it's commented.... I've attached my original file...
Thanks in advance....
P.S.: Also if I change: smf_redirectWrapper('logout_url', "logout;{$_SESSION['session_var']}={$_SESSION['session_value']}"); with your code it says always "session verify error blabla"... I've also cleared the cache but... the same..
P.P.S.: Another issue without any doubt related to this (and also other users here noticed the same) is that if I try to login from the login box in wiki I ALWAYS receive a "password wrong" error.. then I'm redirected to the forum login and if I enter there my details it works!!
again what about my problem?
Quote from: MultiformeIngegno on February 28, 2010, 04:34:55 PM
Oldiesmann in my Auth_SMF.php if I search that line I find only:
function UserLogoutSMF(&$user) {
smf_sessionSetup();
//smf_redirectWrapper('logout_url', 'logout;sesc=' . $_SESSION['rand_code']);
smf_redirectWrapper('logout_url', "logout;{$_SESSION['session_var']}={$_SESSION['session_value']}");
}
But it's commented.... I've attached my original file...
Thanks in advance....
P.S.: Also if I change: smf_redirectWrapper('logout_url', "logout;{$_SESSION['session_var']}={$_SESSION['session_value']}"); with your code it says always "session verify error blabla"... I've also cleared the cache but... the same..
P.P.S.: Another issue without any doubt related to this (and also other users here noticed the same) is that if I try to login from the login box in wiki I ALWAYS receive a "password wrong" error.. then I'm redirected to the forum login and if I enter there my details it works!!
Does the logout from the wiki work with the code that's there before you change it? My copy of that file is a bit old and doesn't have the line with the curly brackets.
Not sure what to say about the password. Will look into that tomorrow when I have time.
No, the logout doesn't work neighter with your code and the previously attached file..
Any news with this Oldiesmann..?
My bridge broke when I moved to 2.0 RC2. is there a working bridge?
Quote from: Leemy on March 05, 2010, 12:39:13 PM
My bridge broke when I moved to 2.0 RC2. is there a working bridge?
Have you changed $wgSMFVersion to 2.0 ?
$wgSMFVersion = "2.0";Anyway, I use it on SMF 2.0 RC2 fairly well (apart the problem I've posted above.. :P)!
Quote from: MultiformeIngegno on March 05, 2010, 01:24:53 PM
Quote from: Leemy on March 05, 2010, 12:39:13 PM
My bridge broke when I moved to 2.0 RC2. is there a working bridge?
Have you changed $wgSMFVersion to 2.0 ?
$wgSMFVersion = "2.0";
Anyway, I use it on SMF 2.0 RC2 fairly well (apart the problem I've posted above.. :P)!
Sorry Im really new to the bridge where in MediaWiki do I change this? Thanks.
Quote from: Leemy on March 05, 2010, 01:57:07 PM
Quote from: MultiformeIngegno on March 05, 2010, 01:24:53 PM
Quote from: Leemy on March 05, 2010, 12:39:13 PM
My bridge broke when I moved to 2.0 RC2. is there a working bridge?
Have you changed $wgSMFVersion to 2.0 ?
$wgSMFVersion = "2.0";
Anyway, I use it on SMF 2.0 RC2 fairly well (apart the problem I've posted above.. :P)!
Sorry Im really new to the bridge where in MediaWiki do I change this? Thanks.
Not in MediaWiki, open Auth_SMF.php and search that line! ;)
Hm ok so I commented out the 1.1 line and uncommented the 2.0 line. But I still receive this error when I visit my Wiki:
Unable to view external table.
mySQL error number: 0
mySQL error message:
Decided I will try mediawiki, how do I get this working? on SMF's side, mediawiki's?
Any plans to upgrade this to support postgresql for those of us running our SMF under it?
NVM, figured it out a few days ago...
I've tried the bridge with the new 1.16beta and it doesn't work!!
I've gotten the bridge to work properly! Thanks!
I just wish I could figure out how to blend it into my site like you did! :)
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.
@karl1990: a chance that you make a new one....? :P
Quote from: karl1990 on April 02, 2010, 03:00:31 AM
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.
Actually in this bridge you can setup a SMF group as sysop and thus when you make changes to the group in SMF it reflects on the wiki sysop group. The reverse isn't possible unfortunately, meaning that you have to manually remove sysops from the group even if you already did it on the corresponding SMF group.
anybody have version 1.13 of this script?
The source is down:
http://wgnrs.dynalias.com/smf/Auth_SMF.php
http://www.mediawiki.org/wiki/Extension:SMF_Auth_Integration
and the last version that archive.org has is 1.10:
http://web.archive.org/web/*/http://wgnrs.dynalias.com/smf/Auth_SMF.php
I've got it working but am experiencing the issues fixed in 1.11, 1.12 and 1.13.
DynaBonk I have it, unfortunately I'm not at home.... if you send me a pm I'll remember this and I'll send it to you.
Quote from: karl1990 on April 02, 2010, 03:00:31 AM
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.
karl1990's post is a quote of rsw686's first post. The only bit that was karl1990 was "Neither of these two bridges check to make sure the users are activated and not banned before logging them in."
The download link worked fine for me just now.
I get this error since going to 2.0 RC2
Unable to view external table.
mySQL error number: 0
mySQL error message:
I have already set the Auth SMF config to 2.0 instead of 1.0. Any suggestions? Thanks!
Hello.
After hours of Googling, adding die('function name'); everywhere in the file. I managed to finally get that thing to work with SMF 2 RC3 and MediaWiki 1.15.3! Well at last it looks like that. Modded file is attached to this post.
The cause of trouble was that AutoAuthenticate Hook in MediaWiki was deprecated in version 1.13, so that Bridge wouldn't work with anything equal or higher than MediaWiki 1.13.
The solution was simple changing AutoAuthenticate Hook to UserLoadFromSession :)
My fix is ugly because I know almost nothing about media wiki nor SMF but at last it seems to work...
Logging in - works,
forum membergroups privileges on wiki, works too.
There are (at last) there things (I mean problems) left:
1. When trying to log out from Wiki, I get redirected to SMF and get
QuoteAn Error Has Occurred!
Session verification failed. Please try logging out and back in again, and then try again.
Any suggestion what happens here? For what should I go google tomorrow? :D
2. When I try to log in via wiki, I get redirected to SMF log-in panel, and after successful log-in, I'm not redirected back to wiki
Is that a bug, or is that SMF functionality restriction?
3. After logging out from SMF i stay logged in on wiki for a while... I think that's caused by nginx and my admins crazy cache settings...
If any one could test it on Mediawikis higher than 1.13 and report if there are any more problems left that would help because, I would spent my time just on Googling and trying to "fix" that... (it shouldn't matter if you use smf 1.1.11 or smf 2.0 just wiki have to be equal or higher than 1.13.0)
Invers I've reproduced the points 1) e 2)... and I've asked a solution the previous pages, but nothing.... :(
Ok I'll look at that, wish me a lucky Googling ^^"
About the 2) I think the problem is on SMF part (well actually I read somewhere, can't remember where, that SMF just can't do that, maybe rc3 can?)
About 1) I will dig in that tomorrow. Maybe I will manage to fix that with the power of almighty Google...
Oh, I forgot to ask yesterday...
MultiformeIngegno, I take that you didn't have problems like point 3?
Thanks for this bridge I have not read the hole thread here as it is 13 odd pages long. What I would like to know is if this will work if your forum is installed under another subdomain as I have installed some of the CMS bridges but never could get it to work just blank pages I was using the full paths to smf in the bridges i.e /vhosts/mydomain/subdomains/subdoain name/ ect. so befor I download this will it work like that with the wiki in one sub domain and the forum in another
nay27uk, I can't tell for sure, but it should work. Read the comments that is just above setting $wgCookieDomain in Auth_SMF.php
I think that's what you are looking for.
Quote from: Invers on May 22, 2010, 09:17:10 PM
nay27uk, I can't tell for sure, but it should work. Read the comments that is just above setting $wgCookieDomain in Auth_SMF.php
I think that's what you are looking for.
thankyou I have decided to move everuthing into my main root of the site and place them in seperat folders i.e mydomain.co.uk/forum mydomain.co.uk/wiki ect had to make this desition as I wanted to include the forum ect into the main site pages but with them being in sub domains this was proving extremley tricky to acomplish.
Any bridge who works fine with SMF 1.1.11 and MediaWiki 1.15.3?
I have a problem and wondered if you can help.
When I click on logout from the wiki and it takes me back to SMF I get this error displayed inside SMF
Quote
Unable to verify referring url. Please go back and try again.
@nay27uk
Well, I have same problem here... I was trying to figure something out, but because of high fever, I'm always giving up, and going back to my warm bed.
@Succubus Evaligan, depends what do you mean by "works fine", this one (not from first post, I attached a little modified version to one of my earlier post in this topic) basically works for smf 2.0rc3, it have some problems with log out via wiki, and redirecting back to wiki after login. everything else looks like works as it should. This bridge should work for SMF 1.1.11 as well... In the end, it looks like you will have to test it yourself.
ok not to worry I will only be allowing admins to edit the wiki anyway so its not to major thing.
I will closely monitor this thread and hope for a fix.
Thanks for the reply
Hello, here is a fix for session verification fail.
Manual instruction:
go to line 329 Auth_SMF.php
you should see something like that:
function UserLogoutSMF(&$user) {
smf_sessionSetup();
smf_redirectWrapper('logout_url', 'logout;' . $_SESSION['session_var'] . '=' . $_SESSION['rand_code']);
}
Change it to:
function UserLogoutSMF(&$user) {
smf_sessionSetup();
if(isset($_SESSION['session_value']))
smf_redirectWrapper('logout_url', 'logout;' . $_SESSION['session_var'] . '=' . $_SESSION['session_value']);
else
smf_redirectWrapper('logout_url', 'logout;' . $_SESSION['session_var'] . '=' . $_SESSION['rand_code']);
}
After that, you shouldn't see any more "Session verification failed. Please try logging out and back in again, and then try again." error
For lazy people, I attached already modified Auth_SMF.php. but be careful because:
It wont work with mediawiki older than 1.13
I did not test it on smf 1.1.11
I was testing it on my setup which is SMF 2 RC3 and MediaWiki 1.15.3. Aside from not doing redirects from logout/login pages back to wiki, it was working fine for me.
So it would be great if someone with smf 1.1.11 tested it ^^
Now all that is left are redirects from login/logout/registration pages back to wiki. But... I have no idea how that works in smf and what is going on with that wiki extension...
----------
Here I will try to explain what was the cause of this ""Session verification failed. Please try logging out and back in again, and then try again." error :)
Look at this code.
function smf_sessionSetup() {
global $wgCookiePath;
// Clean out the existing session. This should have no affect
// since we are going to redirct the user to the SMF page.
session_destroy();
session_start();
// Load up the SMF session and set the redirect URL.
if(isset($_COOKIE['PHPSESSID']))
session_decode(smf_sessionRead($_COOKIE['PHPSESSID']));
// No exisiting session, create one
else
{
// Grab us a unique ID for SMF.
session_regenerate_id();
// Needed for SMF checks.
$_SESSION['rand_code'] = md5(session_id() . rand());
$_SESSION['USER_AGENT'] = $_SERVER['HTTP_USER_AGENT'];
die('rand code ='.$_SESSION['rand_code'].'');
$_COOKIE['PHPSESSID'] = session_id();
setcookie('PHPSESSID', session_id(), time() + 3600, $wgCookiePath, '', 0);
}
}
It looks like that if "if(isset($_COOKIE['PHPSESSID']))" returned true, then the variable $_SESSION['rand_code'], was never set anywhere, so logout function was using non-existent variable. therefore after logout attempt from wiki all we saw was "Session verification failed. Please try logging out and back in again, and then try again."
@Invers: Thanks for your "wordaround", anyway for me it doesn't work... :(
I think it's caused by this:
http://dev.simplemachines.org/mantis/view.php?id=4244
In short: when you have a forum installed in a subdomain and then you call ssi.php (like here SMF_auth does) from ANOTHER subdomain (also if "enable indipendent cookies" is on) many of the integration functions don't work because of this session obfuscation bug! So you always receive a "session verification failed" or a "password wrong" error also if password is correct... :(
MultiformeIngegno, well I have installed everything in one domain like this:
www.mydomain.pl/forum
www.mydomain.pl/wiki
and I wanted it to work at last in that config, and it's working.
I don't know much of SMF code and all, but it looks like this bridge don't use SSI.php at all.
Are you sure that in the part which you copy to mediawiki config file, LocalSettings.php, you set everything right?
I mean this:
# Make "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.org';
#$wgCookiePath = '/'; // Optional, defaults to '/'
#$wgCookieSecure = false; // Optional, only change on scheme mismatch
In your case, $wgCookieDomain should be set to '.domain.org'
if it's set as it should and it does not work, then, well I can't do much about it :(
Quote from: MultiformeIngegno on March 26, 2010, 02:26:25 AM
I've tried the bridge with the new 1.16beta and it doesn't work!!
They released 1.16beta3...
Someone who wants to "investigate" on why the bridge doesn't work anymore on the new version..? :P
So I installed this bridge on my localhost server and currently it does nothing. When I login to SMF and then go to the wiki, it's logged out. I click login and it directs me to SMF. I login and am back to SMF's main page.
When I manually login to the wiki, I click logout and it shows an SMF page saying Session Unverified, please login/logout again.
Quote from: fred2028 on June 29, 2010, 02:14:04 PM
So I installed this bridge on my localhost server and currently it does nothing. When I login to SMF and then go to the wiki, it's logged out. I click login and it directs me to SMF. I login and am back to SMF's main page.
That is right, file in first post is a bit outdated and won't work with current wiki version.
Quote from: fred2028 on June 29, 2010, 02:14:04 PM
When I manually login to the wiki, I click logout and it shows an SMF page saying Session Unverified, please login/logout again.
True, that is a bug. I had that problem too.
Did you try using that file I posted (http://www.simplemachines.org/community/index.php?topic=221622.msg2647536#msg2647536)? It works for me.
Im running this successfully between 2.0RC3 and 1.14. Will I have an issue in upgrading to 1.15? Does it bring benefits for a sparsely used, basic wiki? I doubt it, but am asking.. Thanks,
It will work fine 'til 1.15 (included), only 1.16 isn't supported... For changes in 1.15 you can read the changelog at mediawiki.org. :)
Good news. It will work with latests mediawiki beta.
I figured out what was wrong. I just need to make sure it wont stop working on 1.15
@Invers: you own a kiss if you post a version that works with 1.16! :P
Ok, it should work now on mediawiki from 1.13 to 1.15.4 and 1.16betas.
And I have even more good news :3
Login/Logout redirecting works now as it should (at last for me) - I tested it on mediawiki 1.15 it should work on 1.16 to, someone need to test
I was trying to do full testing on my combo - kinda broken smf2.0rc3 install + mediawiki 1.16beta3 but it acting a bit random (I have broken apache and php on my local server)
On my server where I have normal smf2.0rc3 install + mediawiki 1.15.4, there is no problems. it works great :3
If someone want to know what was wrong.
line 183 should look like that
function AutoAuthenticateSMF($user, &$result) {
and it was
Quotefunction AutoAuthenticateSMF(&$user, &$fix) {
the main problem was that ampersand before $user, dunno if &$fix was a problem too.
Attached already modified file, test it and tell if it works
Tomorrow I'll try with 1.16 beta! ;)
Quote from: MultiformeIngegno on July 03, 2010, 07:22:27 PM
Tomorrow I'll try with 1.16 beta! ;)
It works!!!! :D
Thanks Invers!!!! The only problem I've noticed is the old "session verification failed" that I always had also with previous Auth_SMF.php...
@MultiformeIngegno
The "session verification failed" must have something to do with subdomian config you are using.
I will look into that at the end of this week... Well once I figure out how to create subdomians on my localhost with is windows+xampp ^^'
Having trouble with 1.16 :(
It seems to identify the sessions correctly from SMF, but when I try to edit a page, it show the "Lost session data" error. No idea what can be wrong.
[edit]
Got it!
There was an error on the cookie domain. It was defined with www. and I wasn't using it on the url.
Now I have another problem. If I logout of SMF, the session is not destroyed in MediaWiki.
I worked around with
if($ID_MEMBER == 0)
{
session_destroy();
if($user->isLoggedIn()){
$user->logout();
}
return true;
}
But this only works on the second page load on mediawiki after loggin out.
rsw686, are you still developing this? Sorry for not reading the entire topic, I read the first two or so pages.
Any reason you didn't choose to make this in to a mod? People (like me) would be very interested in it as a mod. At least make the file downloadable from this site.
Any reason you didn't go with the SMF functions since you are already using API file?
I've made some changes to it and I'm making some more which I will upload here shortly.
rsw686 is no more developing this bridge (I think he moved to another platform..)! :(
Quote from: groundup on August 28, 2010, 12:25:35 PM
I've made some changes to it and I'm making some more which I will upload here shortly.
Great! Keep us updated! :)
Something new here ?
no update right now. The current bridge which we are using is far too specific to the oddness that is simplemachines.org and is not currently extensible.
I seem to be having a bit of trouble getting this up and running. I've recently installed mediawiki and have installed this bridge to get it connected with my forum. However, when I click the log-in button it redirects me to the forum login page. I login there and then it only logs me in on the forum. If I return to the wiki page, I am not logged in.
Here is my LocalSettings file.
# SMF Authentication
# To get started you only need to configure wgSMFPath and wgSMFVersion.
# The rest of the settings are optional for advanced features.
# Relative path to the forum directory from the wiki
# Do not put a trailing /
# Example: /public_html/forum and /public_html/wiki -> ../forum
$wgSMFPath = "../forum";
# Set to the version of SMF you are using.
#$wgSMFVersion = "1.1";
$wgSMFVersion = "2.0";
# Use SMF's login system to automatically log you in/out of the wiki
# This will only work if you are using SMF database sessions (default).
# Make sure "Use database driven sessions" is checked in the
# SMF Admin -> Server Settings -> Feature Configuration section
# NOTE: Make sure to configure the wgCookeDomain below
$wgSMFLogin = true;
# Make "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.markedrp.com';
$wgCookiePath = '/'; // Optional, defaults to '/'
$wgCookieSecure = false; // Optional, only change on scheme mismatch
# Require members to be a part of this SMF group(s) to login
# NOTE: Members of the SMF Administrator group are always able to login
#$wgSMFGroupName = 'Wiki Editor';
#$wgSMFGroupName = array('Wiki Editor', 'Global Moderator');
# Grant members of this SMF group(s) wiki sysop privileges
# NOTE: These members must be able to login to the wiki
#$wgSMFAdminGroupName = 'Wiki Admin';
#$wgSMFAdminGroupName = array('Wiki Admin', 'Global Moderator');
# Load up the extension
require_once "$IP/extensions/Auth_SMF.php";
$wgAuth = new Auth_SMF();
Forum URL: www.markedrp.com/forum (http://www.markedrp.com/forum)
Wiki URL: www.markedrp.com/wiki (http://www.markedrp.com/wiki)
Although, with the forum I am using the standalone SimplePortal, which is at www.markedrp.com (http://www.markedrp.com). I'm not sure if that would make a difference.
Any ideas?
Anybody?
I was thinking about this today and wonder if it's maybe due to the fact that my wiki and SMF forum are on different databases. Would I have to manually make the bridge point at the SMF database for the user information?
yes... it will not work with different databases as it is
I actually got it working on different databases. My issue was that I guess there was a compatibility problem between mediawiki 1.16 and the bridge. I'd just misunderstood the versions that a fix I read about was for.
But after I made the following change to AUTH_SMF.php, it works just fine now.
// $wgHooks['AutoAuthenticate'][] = 'AutoAuthenticateSMF'; //original line
$wgHooks['UserLoadFromSession'][] = 'AutoAuthenticateSMF'; //fixed line
Edit:
Oh, and I'm having a new issue now. I'm using mediawiki 1.16 and it seems like user preferences are not saving. I try to make a change in the preferences, but there is no "saved" message and it has no effect on the wiki. Removing the bridge removes the issue. I have also tried this on a version installed on the same database as the forum and on a version that is on a different database.
I've reinstalled from scratch, but I'm still having the same issue with saving settings. I am using mediawiki 1.16. Has anybody else experienced this problem? The bridge seems to work just fine (though I apparently need to delete my cookies first?). However, while the bridge is installed no changes I make to user preferences will save.
hi,
Thanks to sharing information.......
Any ideas? I've noticed that the mediawiki for this forum does not have the same issue and they are using the same wiki version and, from what I've read, this bridge as a base for their own.
the "bridge" which we are using here is significantly modified from anything which has been distributed.
Using Invers version on SMF 2.0 RC4 and MediaWiki 1.16.1 and Redirection after Login is not working and Logout continues to suffer from those "session verification" errors.
Any ideas?
I have come across the fix guys...
For those encountering the issue with "Session Verification" errors. This is the problem.
http://www.simplemachines.org/community/index.php?topic=374064.msg2666071#msg2666071
Redirection on Logout works correctly now and so does my Logout and Login. Login redirection however is still not working... but oh well, this is the major problem! :)
Hi guys and thanks for all the info., getting there slowly but steadily :)
Am using SMF 2.0 RC4 and MediaWiki 1.16.0 and have progressed to the stage where I can log into SMF and the member is also logged into MW :)
However...
1. when I log out of SMF I am still logged into MW,
2. there is also a strange one where if I log out of MW I see the login link; I then go back to SMF to find I'm logged out - all good. But then when I go back to MW I am logged in again! There seems to be a cache thing with this second one as when I F5 I am logged out.
Any clues for these two?
Quote from: Farjo on January 10, 2011, 09:15:30 PM
Hi guys and thanks for all the info., getting there slowly but steadily :)
Am using SMF 2.0 RC4 and MediaWiki 1.16.0 and have progressed to the stage where I can log into SMF and the member is also logged into MW :)
However...
1. when I log out of SMF I am still logged into MW,
2. there is also a strange one where if I log out of MW I see the login link; I then go back to SMF to find I'm logged out - all good. But then when I go back to MW I am logged in again! There seems to be a cache thing with this second one as when I F5 I am logged out.
Any clues for these two?
Yeah, it happens the same thing in MW 1.13, so it's probably some cache issue that has been there since this bridge was originally produced.
Quote from: Farjo on January 10, 2011, 09:15:30 PM
Am using SMF 2.0 RC4 and MediaWiki 1.16.0 and have progressed to the stage where I can log into SMF and the member is also logged into MW :)
Quick question for you, since I'm using the same versions for both SMF and MediaWiki. The bridge on my end seems to function fine, but user preferences on the wiki do not save when a member tries to change them. Are you experiencing that same bug?
Seems to work for me. What preferences are you losing?
All of them. Any change in preferences at all aren't being saved. There is no "Preferences Saved" message popping up after you hit the save button.
At first, the settings seem to still be there. But if I leave the preferences area and then come back, everything is back to how it was before I tried to change them.
EDIT:
Thanks for all the support guys, I got it working in the end. An extra fix can be seen in my post a couple of posts down.
Bridge number 1 says:
4. Open LocalSettings.php and add the following changes to the bottom of the file(before the ?>).
There is no ?> in the localsettings.php file :-\
Quote from: Invers on May 29, 2010, 01:43:06 PM
Hello, here is a fix for session verification fail.
Manual instruction:
go to line 329 Auth_SMF.php
you should see something like that:
function UserLogoutSMF(&$user) {
smf_sessionSetup();
smf_redirectWrapper('logout_url', 'logout;' . $_SESSION['session_var'] . '=' . $_SESSION['rand_code']);
}
Change it to:
function UserLogoutSMF(&$user) {
smf_sessionSetup();
if(isset($_SESSION['session_value']))
smf_redirectWrapper('logout_url', 'logout;' . $_SESSION['session_var'] . '=' . $_SESSION['session_value']);
else
smf_redirectWrapper('logout_url', 'logout;' . $_SESSION['session_var'] . '=' . $_SESSION['rand_code']);
}
After that, you shouldn't see any more "Session verification failed. Please try logging out and back in again, and then try again." error
For lazy people, I attached already modified Auth_SMF.php. but be careful because:
It wont work with mediawiki older than 1.13
I did not test it on smf 1.1.11
I was testing it on my setup which is SMF 2 RC3 and MediaWiki 1.15.3. Aside from not doing redirects from logout/login pages back to wiki, it was working fine for me.
So it would be great if someone with smf 1.1.11 tested it ^^
Now all that is left are redirects from login/logout/registration pages back to wiki. But... I have no idea how that works in smf and what is going on with that wiki extension...
----------
Here I will try to explain what was the cause of this ""Session verification failed. Please try logging out and back in again, and then try again." error :)
Look at this code.
function smf_sessionSetup() {
global $wgCookiePath;
// Clean out the existing session. This should have no affect
// since we are going to redirct the user to the SMF page.
session_destroy();
session_start();
// Load up the SMF session and set the redirect URL.
if(isset($_COOKIE['PHPSESSID']))
session_decode(smf_sessionRead($_COOKIE['PHPSESSID']));
// No exisiting session, create one
else
{
// Grab us a unique ID for SMF.
session_regenerate_id();
// Needed for SMF checks.
$_SESSION['rand_code'] = md5(session_id() . rand());
$_SESSION['USER_AGENT'] = $_SERVER['HTTP_USER_AGENT'];
die('rand code ='.$_SESSION['rand_code'].'');
$_COOKIE['PHPSESSID'] = session_id();
setcookie('PHPSESSID', session_id(), time() + 3600, $wgCookiePath, '', 0);
}
}
It looks like that if "if(isset($_COOKIE['PHPSESSID']))" returned true, then the variable $_SESSION['rand_code'], was never set anywhere, so logout function was using non-existent variable. therefore after logout attempt from wiki all we saw was "Session verification failed. Please try logging out and back in again, and then try again."
Good idea, didn't quite work for me, but I fixed it:
Original:
function UserLogoutSMF(&$user) {
smf_sessionSetup();
if(isset($_SESSION['session_value']))
smf_redirectWrapper('logout_url', 'logout;' . $_SESSION['session_var'] . '=' . $_SESSION['session_value']);
else
smf_redirectWrapper('logout_url', 'logout;' . $_SESSION['session_var'] . '=' . $_SESSION['rand_code']);
}
New:
function UserLogoutSMF(&$user) {
smf_sessionSetup();
if(isset($_SESSION['session_value']))
smf_redirectWrapper('logout_url', 'logout;' . $_SESSION['session_var'] . 'sesc=' . $_SESSION['session_value']);
else
smf_redirectWrapper('logout_url', 'logout;' . $_SESSION['session_var'] . 'sesc=' . $_SESSION['rand_code']);
}
The key was to analyzing the session logout URL that SMF gives, and changing the above script accordingly. All I needed to do was add "sesc" infront of the =.
After messing around with the files some more today I disabled the SMFLogin by turning it to false. I assume that disabling that would allow me to log on with my forum information already in the wiki database directly instead of going through SMF for verification. I wanted to see if logging in that way would give me the same user preferences error I've been getting.
When I did that, if I tried to log in to the wiki, after submitting my account information I would receive the following error message:
QuoteFrom Marked Wiki
Jump to: navigation, search
Login error
There seems to be a problem with your login session; this action has been canceled as a precaution against session hijacking. Go back to the previous page, reload that page and then try again.
Could that have something to do with my user preferences issue?
Edit: And another weird bug with this active. If I try to import a file to the wiki, no matter the size, I get the following error:
QuoteImport failed: Loss of session data. Please try again.
Importing works if I remove the modification.
I've attached my Auth_SMF.php file to this post. Anybody want to take a look?
okay here is a little problem.
Despite having sessions working brilliantly on other devices, when using my android phone it doesn't seem to sign me into the wiki.
Can someone please post their localsettings.php file, I'm really exhausted at this point :-[
I'm starting to think that my issues are somehow related to my database or something. I reinstalled my wiki and the bridge, but I'm still having the same issues.
If I have the SMFLogin disabled, I either get a "wrong password" error or the following error: "There seems to be a problem with your login session; this action has been canceled as a precaution against session hijacking. Please hit "back" and reload the page you came from, then try again." This happens if I use an account that originated on the wiki or if I try to log in on an account that was pulled from the SMF database. I went into the extension file and turned on new password email generations. And if I submitted that twice it got me past the "session hijacking error" and allowed me to log in after resetting my password (and I could change my preferences then). But if I logged out and went back, I'd get the wrong password and session hijacking errors again.
If I turn off the mod entirely, logging in works just fine again.
I am at a loss. x.x
Goss, just to let you know I logged in as a regular member and added a signature - it is still there after I have logged out/in and been elsewhere :-\
So, I am so relieved to say that I finally got this working. It ended up being a lot simpler than I thought it was. >.>
Anyway, I now have a new issue I am trying to solve. The bridge is working great. However, I am trying to set it up so that only two specific usergroups can actually edit the wiki.
I created a new usergroup for mediawiki called "Wiki Editor":
# This creates a new wiki user group called "Wiki Editor".
$wgGroupPermissions['Wiki Editor'] = $wgGroupPermissions['user'];
Then turned on the following code in LocalSettings.php:
# Require members to be a part of this SMF group(s) to login
# NOTE: Members of the SMF Administrator group are always able to login
$wgSMFGroupName = 'Wiki Editor';
$wgSMFGroupName = array('OOC', 'Moderator');
When this is active, I can log in just fine with my forum Admin account. However, if I try and log in with any other account (including the groups above), then I get the following error:
QuoteUnable to find SMF group(s) set in LocalSettings.php!
Any ideas?
Oh, I figured it out. I had multiple SMF membergroups called "Moderator", so it was getting confused. I just renamed the one I needed and it's working now.
I get this error when ever I go to the wiki:
Warning: Parameter 1 to AutoAuthenticateSMF() expected to be a reference, value given in /home/arekay/public_html/wiki/includes/Hooks.php on line 133
what does this mean and how can I fix it?
Let me guess, you have PHP 5.3.x, right?
Yes I have PHP 5.3.4, is that a problem?
Quote from: Arekay on February 15, 2011, 07:38:53 PM
Yes I have PHP 5.3.4, is that a problem?
When I upgraded PHP 5.2.x to 5.3.4 that error came up. Found the solution in this post: http://www.simplemachines.org/community/index.php?topic=221622.msg2689257#msg2689257
(even if you don't have the line exactly as it says there, make sure you change it to
function AutoAuthenticateSMF($user, &$result) ).
This simple edit worked for me. I've found out later that there are also other mediawiki extensions including mediawiki itself v1.13 -> v1.15 with compatibility problems with PHP 5.4.3 and I could fix some of them by just changing one or two characters like the ampersand "&").
That fixed it, thanks!
Yea! I got a new error!
Fatal error: Call to undefined method User::setupSession() in /home/arekay/public_html/w/extensions/Auth_SMF.php on line 308
I've got 2.0RC5 and MediaWiki 18
Quote from: Arekay on February 21, 2011, 03:41:29 PM
Yea! I got a new error!
Fatal error: Call to undefined method User::setupSession() in /home/arekay/public_html/w/extensions/Auth_SMF.php on line 308
I've got 2.0RC5 and MediaWiki 18
I use SMF 1.1.x and Mediawiki 1.13 so can't help you with that.
Quote from: Arekay on February 21, 2011, 03:41:29 PM
Yea! I got a new error!
Fatal error: Call to undefined method User::setupSession() in /home/arekay/public_html/w/extensions/Auth_SMF.php on line 308
I've got 2.0RC5 and MediaWiki 18
It seems that your path in Local Settings is not correct... If your forum is in /arekay and your Wiki in /arekay/w you have to set it like this
# Relative path to the forum directory from the wiki
# Do not put a trailing /
# Example: /public_html/forum and /public_html/wiki -> ../forum
$wgSMFPath = "..";
Quote from: Arekay on February 21, 2011, 03:41:29 PM
Yea! I got a new error!
Fatal error: Call to undefined method User::setupSession() in /home/arekay/public_html/w/extensions/Auth_SMF.php on line 308
I've got 2.0RC5 and MediaWiki 18
It seems odd that you in a former post have your wiki in /arekay/public_html/wiki
Warning: Parameter 1 to AutoAuthenticateSMF() expected to be a reference, value given in /home/arekay/public_html/wiki/includes/Hooks.php on line 133
Quote from: henrik1782 on February 25, 2011, 05:13:56 AM
It seems that your path in Local Settings is not correct... If your forum is in /arekay and your Wiki in /arekay/w you have to set it like this
# Relative path to the forum directory from the wiki
# Do not put a trailing /
# Example: /public_html/forum and /public_html/wiki -> ../forum
$wgSMFPath = "..";
I did have this wrong, I had $wgSMFPath = "../";
I fixed this, yet I still get the same error... any ideas?
Quote from: henrik1782 on February 25, 2011, 05:17:00 AM
It seems odd that you in a former post have your wiki in /arekay/public_html/wiki
I decided to delete the wiki and start over, this time I put it in /w
Could someone tell me how I can add a module to my main forum of the newest topic (article) added to the wiki - Kind of like a feed?
Hello everybody! Problem: wiki 1.16.2 and smf 2.0rc4
wiki - wiki.domain.org
smf - domain.org
use different bases
If I try login onto wiki, goes redirect to forum login form, logins ok but does'nt come back to wiki. Reloading wiki I see that I am not logged in. Reloading forum shows I logged onto forum only.
#$wgEnableParserCache = false;
#$wgCachePages = false;
$wgSMFPath = "../";
$wgSMFVersion = "2.0";
$wgSMFLogin = true;
$wgCookieDomain = 'www.wiki.domain.org';
$wgCookiePath = '/';
$wgCookieSecure = false;
$wgSMFGroupName = 'Wiki Editor';
$wgSMFGroupName = array('Wiki Editor', 'Global Moderator');
#$wgSMFAdminGroupName = 'Wiki Admin';
#$wgSMFAdminGroupName = array('Wiki Admin', 'Global Moderator');
$wgAuth = new Auth_SMF();
Thanks
It is ok, I should use independent cookies for subdomains in SMF settings and clear cookies in browser. It works, thanks.
Hello excuse me for my english.
I have installed the bridge but i have this error:
"Wiki has a problem
Sorry! This site is experiencing technical difficulties.
Try waiting a few minutes and reloading.
Can't contact the database server: Unknown error"
When disable the bridge, the error disappear.
Can anyone help me please?
Thanks.
I installed the wiki to my main address biology-forums.com/wiki/ and it takes a long time to load; somewhat slow.
If I change the location to wiki.biology-forums.com (sub-address), would it increase the loading speed?
Hi,
Is it possible to rung this brodge across different domains?
eg mydomain.org/wiki
and
mydomain.com/forum
?
if so, how? At the moment it logs into the forum but not the wiki
Quote from: poveyjo on December 03, 2011, 04:41:40 PM
Hi,
Is it possible to rung this brodge across different domains?
eg mydomain.org/wiki
and
mydomain.com/forum
?
if so, how? At the moment it logs into the forum but not the wiki
I tried this, but there is an issue with the logging in. It doesn't work across different domains. :-\
Thanks Shuban...
Ok, I thought so.
Although now I've tried it with a brand new forum installation (1.15) on the same domain, and I get the same problem.
That is, the MW links point to SMF logon, but it doesn't log the user into the wiki also...
I'm using MW1.17 (with semantic mediawiki) and SMF 1.15.
Does anyone have this working with MW 1.17?
My Config:
(in auth_smf.php):
$wgHooks['UserLoadFromSession'][] = 'AutoAuthenticateSMF'; //fixed line
IN localsettings:
# If you experience the issue where you appear to be logged in
# eventhough you are logged out then disable the page cache.
#$wgEnableParserCache = false;
#$wgCachePages = false;
# SMF Authentication
# To get started you only need to configure wgSMFPath and wgSMFVersion.
# The rest of the settings are optional for advanced features.
# Relative path to the forum directory from the wiki
# Do not put a trailing /
# Example: /public_html/forum and /public_html/wiki -> ../forum
$wgSMFPath = "/forums";
# Set to the version of SMF you are using.
$wgSMFVersion = "1.1";
#$wgSMFVersion = "2.0";
# Use SMF's login system to automatically log you in/out of the wiki
# This will only work if you are using SMF database sessions (default).
# Make sure "Use database driven sessions" is checked in the
# SMF Admin -> Server Settings -> Feature Configuration section
# NOTE: Make sure to configure the wgCookeDomain below
$wgSMFLogin = true;
# Make "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.peakbagging.org.nz';
#$wgCookiePath = '/'; // Optional, defaults to '/'
#$wgCookieSecure = false; // Optional, only change on scheme mismatch
# Require members to be a part of this SMF group(s) to login
# NOTE: Members of the SMF Administrator group are always able to login
#$wgSMFGroupName = 'Wiki Editor';
#$wgSMFGroupName = array('Wiki Editor', 'Global Moderator');
# Grant members of this SMF group(s) wiki sysop privileges
# NOTE: These members must be able to login to the wiki
#$wgSMFAdminGroupName = 'Wiki Admin';
#$wgSMFAdminGroupName = array('Wiki Admin', 'Global Moderator');
# Load up the extension
require_once "$IP/extensions/Auth_SMF.php";
$wgAuth = new Auth_SMF();
Thanks
Check out mine, it works perfectly fine and synchronizes with the username and logins.
http://biology-forums.com/definitions/index.php?title=Biology_Dictionary
OK SO!!
After spending about an hour on this looking through various fixes and whatnot, I've got this working fully and seemingly perfectly.
Versions
SMF - 2.0.1
MediaWiki - 1.16.5 (From MediaWiki Download Archive)
This Mod - Fresh download of original from first post
All you need to do is the following:
Find
function AutoAuthenticateSMF(&$user) {
Replace with
function AutoAuthenticateSMF($user) {
(Removes the &)
Find
if (isset($_COOKIE[$smf_settings['cookiename']]))
{
$_COOKIE[$smf_settings['cookiename']] = stripslashes($_COOKIE[$smf_settings['cookiename']]);
// Fix a security hole in PHP 4.3.9 and below...
if (preg_match('~^a:[34]:\{i:0;(i:\d{1,6}|s:[1-8]:"\d{1,8}");i:1;s:(0|40):"([a-fA-F0-9]{40})?";i:2;[id]:\d{1,14};(i:3;i:\d;)?\}$~', $_COOKIE[$smf_settings['cookiename']]) == 1)
{
list ($ID_MEMBER, $password) = @unserialize($_COOKIE[$smf_settings['cookiename']]);
$ID_MEMBER = !empty($ID_MEMBER) && strlen($password) > 0 ? (int) $ID_MEMBER : 0;
}
}
After this, add
else {
// Remove cookies and session
$_COOKIE = array();
if (session_id() != '') {
session_destroy();
}
}
Find
function UserLogoutSMF(&$user) {
smf_sessionSetup();
smf_redirectWrapper('logout_url', 'logout;sesc=' . $_SESSION['rand_code']);
Replace with
function UserLogoutSMF(&$user) {
smf_sessionSetup();
smf_redirectWrapper('logout_url', "logout;{$_SESSION['session_var']}={$_SESSION['session_value']}");
Find
$wgHooks['AutoAuthenticate'][] = 'AutoAuthenticateSMF';
Replace with
$wgHooks['UserLoadFromSession'][] = 'AutoAuthenticateSMF';
And all seems to be working well. I've attatched the modded file for anyone that wants to use it, but I'm no coder, so if this doesnt work for you, sorry I can't help. I'm just posting what worked for me :)
Cheers guys for the help :D
Quote from: poveyjo on December 03, 2011, 06:20:15 PM
Thanks Shuban...
Ok, I thought so.
Although now I've tried it with a brand new forum installation (1.15) on the same domain, and I get the same problem.
That is, the MW links point to SMF logon, but it doesn't log the user into the wiki also...
I'm using MW1.17 (with semantic mediawiki) and SMF 1.15.
Does anyone have this working with MW 1.17?
I have a test wiki working with SMF 1.1.15... MW 1.18. ;)
You'll have to change line 308 on SMF_Auth from:
$user->setupSession();
to:
wfsetupSession();
... and many extensions will no longer work (if you're updating the wiki).
For anyone interested...
To fix the problem with characters like á à ã ç and similar, using UTF8, you can do this:
In SMF_Auth.php add:
mysql_query("SET NAMES utf8");
mysql_query("SET CHARACTER_SET utf8");
After the connection to SMF.
Meaning that these lines of code:
/**
* Connect to the database. Use the settings from smf.
*
* {@source}
* @return resource
*/
function connect()
{
global $smf_settings;
// Connect to database.
$this->conn = @mysql_connect($smf_settings['db_server'], $smf_settings['db_user'],
$smf_settings['db_passwd'], true);
// Check if we are connected to the database.
if (!$this->conn)
{
$this->mysqlerror("There was a problem when connecting to the SMF database.<br />\n" .
'Check your host, username, and password settings.');
}
// Select database: this assumes the wiki and smf are in the same database.
$db_selected = @mysql_select_db($smf_settings['db_name'], $this->conn);
// Check if we were able to select the database.
if (!$db_selected)
{
$this->mysqlerror("There was a problem when connecting to the SMF database.<br />\n" .
'The database ' . $smf_settings['db_name'] . ' was not found.');
}
}
Turn out to be like this:
/**
* Connect to the database. Use the settings from smf.
*
* {@source}
* @return resource
*/
function connect()
{
global $smf_settings;
// Connect to database.
$this->conn = @mysql_connect($smf_settings['db_server'], $smf_settings['db_user'],
$smf_settings['db_passwd'], true);
// Check if we are connected to the database.
if (!$this->conn)
{
$this->mysqlerror("There was a problem when connecting to the SMF database.<br />\n" .
'Check your host, username, and password settings.');
}
// Select database: this assumes the wiki and smf are in the same database.
$db_selected = @mysql_select_db($smf_settings['db_name'], $this->conn);
// Check if we were able to select the database.
if (!$db_selected)
{
$this->mysqlerror("There was a problem when connecting to the SMF database.<br />\n" .
'The database ' . $smf_settings['db_name'] . ' was not found.');
}
// Fix for weird characters in usernames
mysql_query("SET NAMES utf8");
mysql_query("SET CHARACTER_SET utf8");
// End
}
It worked for me. ;)
If nobody has seen it yet, the SMF Team has released their modified version of the SMF-MediaWiki bridge here: http://www.simplemachines.org/community/index.php?topic=461612.0
It's been updated to work flawlessly with SMF 2.0.1 and brings performance increases as well as upgraded user account stability.
The file has been released on github and with a BSD license, so anyone is free to fork it and bring over any improvements they may have developed themselves.
Quote from: Sinistercat on September 12, 2009, 03:25:18 AM
I fixed the issue. In case anyone else has this problem its a simple fix.
Find:
183: function AutoAuthenticateSMF(&$user) {
Replace with:
183: function AutoAuthenticateSMF($user) {
just remove the "&" in front of $user as well as make the nessisary 1.13 > change of "UserLoadFromSession" and it should work fine.
Thanks for the fix, had the same issue :D
Hi !
Is this a version 2.0.2 (or 2.0.x) are in progress ? because the bridge not work and relative path not work too whit a Auth_SMF.php for 2.0