News:

Want to get involved in developing SMF? Why not lend a hand on our GitHub!

Main Menu

SMF and MediaWiki Bridge

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

Previous topic - Next topic

Shaden

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: hxxp:www.mysite.com/forums [nonactive]
Wiki: hxxp:www.mysite.com/w [nonactive]    (note that I'm using the hxxp:www.mediawiki.org/wiki/Manual:Short_URL [nonactive] 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.

shaitanfr

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.

Paracelsus

Have you guys checked the "hook" issue that need changing posted on the last pages?

Shaden

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.

sart

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: hxxp:rpgaliance.ru [nonactive]
wiki: hxxp:imperial.rpgaliance.ru [nonactive]
LocalSettings.php:
$wgSMFPath = "../../public_html";

$wgSMFVersion = "1.1";

$wgSMFLogin = true;

$wgCookieDomain = '.rpgaliance.ru';


Thanks!

H

As this is an unofficial bridge, I'm going to mark this as solved to remove it from our support queue
-H
Former Support Team Lead
                              I recommend:
Namecheap (domains)
Fastmail (e-mail)
Linode (VPS)
                             

littenburg

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)

Cucurbita

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

Irythros

http://www.mediawiki.org/wiki/Extension:SMF_Auth_Integration [nofollow]

1) Install the forum (for example we'll use www.example.com/forum/ [nofollow])
2) Install mediawiki (ex: www.example.com/wiki/ [nofollow])
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.

MultiformeIngegno

When I try to logout from the wiki I receive a "session verification" error!! :(
How can I fix this?
Thanks in advance!
RockCiclopedia (wiki - forum), Tutta la storia del rock, scritta da voi ...
Rimanere aggiornati sul mondo della musica grazie al nuovo feed "RockCiclopedia Music News"!

Shadowwolf_tw

#190
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.

Paracelsus

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

Paracelsus

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. ;)

Shadowwolf_tw

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.

choloman05

#194
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?

Gika

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.

choloman05

Thank you Gika, that seems to have worked.

Axeia

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).

johanbcn

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] hxxp:pastebin.com [nonactive] [slash] f392b875f

MultiformeIngegno

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..?
RockCiclopedia (wiki - forum), Tutta la storia del rock, scritta da voi ...
Rimanere aggiornati sul mondo della musica grazie al nuovo feed "RockCiclopedia Music News"!

Advertisement: