Simple Machines Community Forum

Customizing SMF => Bridges and Integrations => Topic started by: burnacid on January 30, 2011, 08:42:19 AM

Title: Forum integration in CMS MS
Post by: burnacid on January 30, 2011, 08:42:19 AM
Dear developers

Im a webdeveloper that is working on a site for a lan party.
What i like to do i include the authentication of SMF in modules of the CMS system

Making the modules is no problem but the external authentication is.
Can someone tell me how i can do that.

NOTE: i have read the FAQ and stuff, but i cant figure it out from there.
i used the SSI once but then i get a login field but it does not work propper i guess.

The funtion i need is that it checks if you are logged in.
If so i like to get the username and possibly more user info. (in php variable/array)
if not logged it should show a login field that logs in and returns to the page where it was.

Already thanks for any help!

Here is what i have now, but it does not work propperly
http://lan.burnacid.com/ (http://lan.burnacid.com/)


require("/home/lan/domains/lan.burnacid.com/public_html/forum/SSI.php");
$login = ssi_welcome("return");

if(!$login['is_guest']){
    echo 'Welcome '. $login['username'].'<br />';
    ssi_logout("http://lan.burnacid.com/index.php");
}else{
    ssi_login("http://lan.burnacid.com/index.php");
}

Title: Re: Forum integration in CMS MS
Post by: Kindred on January 30, 2011, 04:59:49 PM
look at the integration functions.

SSI is great for building smf into site pages... but to check login and pass valid user data, you should probabl use the integration functions.


the user info is in an array called $userinfo
Title: Re: Forum integration in CMS MS
Post by: burnacid on January 30, 2011, 05:37:07 PM
Well also looked into that but its so unclearly explained.
No examples to found (atleast i didn't)
Title: Re: Forum integration in CMS MS
Post by: Arantor on January 31, 2011, 07:42:51 AM
All you have to do is include SSI.php into your page.

At that point, $context['user'] will exist and serve up all kinds of information about the currently authorised user, assuming a session could be loaded and that subdomain independent cookies are enabled. ssi_login() is only used to actually display a login form...
Title: Re: Forum integration in CMS MS
Post by: Kindred on January 31, 2011, 08:41:02 AM
however, if he is looking to link the logins, te integration functions are probably a cleaner way to do that
Title: Re: Forum integration in CMS MS
Post by: Arantor on January 31, 2011, 09:33:31 AM
He says he needs to check whether a user is logged in or not, which SSI does as a matter of course. The integrate functions can't directly be called from outside SMF to achieve the same thing.
Title: Re: Forum integration in CMS MS
Post by: Kindred on January 31, 2011, 12:18:29 PM
well, he said he wants to check if a user is logged in and if so, get user data.

I inferred that he was looking to link the logins (i.e. if logged into smf, also log into the cms)

maybe I inferred incorrectly, but that seemed to be the next logical question.
Title: Re: Forum integration in CMS MS
Post by: burnacid on January 31, 2011, 12:37:42 PM
Well both stories have a true to it.

I found now how to check if logged in.
But i also like if he is not logged in that a login form is displayed and if you login through that you should return to that page

SSI can login but then i end up on the index.php of the forum even if i redirect to the originating page.
Do i do something wrong?

forexample this works exept the login or logoff ($login has the var's i need) and i like them to work to

require("/home/lan/domains/lan.burnacid.com/public_html/forum/SSI.php");
$login = ssi_welcome("return");

if(!$login['is_guest']){
    echo 'Welcome '. $login['username'].'<br />';
    ssi_logout("http://lan.burnacid.com/index.php");
}else{
    ssi_login("http://lan.burnacid.com/index.php");
}
Title: Re: Forum integration in CMS MS
Post by: Arantor on January 31, 2011, 12:43:43 PM
Looks to me as though there's an issue in the ssi_login function (and IIRC there's been issues with that for a while). On my own site where I needed it, I just set the URL manually in $_SESSION (I forget exactly which variable, but $_SESSION['redirect_url'] springs to mind for some reason but don't quote me on that) and then output the form manually since I wanted to custom-style it.
Title: Re: Forum integration in CMS MS
Post by: burnacid on January 31, 2011, 01:36:31 PM
Well i read the code from SSI, but it sets a $_SESSION['login_url'].

if i set that manualy its does not work either.
The var is not passed on to the forum's login script.
So for the login script the login works but the redirect not

Coming to the logout

That does not work at all, the rand_code appears to be invalid
Title: Re: Forum integration in CMS MS
Post by: Arantor on January 31, 2011, 01:54:16 PM
It's not a random code, per se, it's a session ident. If it's invalid, SSI can't load the proper session which likely means your CMS is trying to manage its own session (you need to put SSI *first*)
Title: Re: Forum integration in CMS MS
Post by: burnacid on January 31, 2011, 01:58:12 PM
But how?
Title: Re: Forum integration in CMS MS
Post by: Arantor on January 31, 2011, 02:00:56 PM
Whatever you include SSI.php make sure it's the FIRST thing. Without knowing the innards of your CMS we can't possibly tell you where to change it...
Title: Re: Forum integration in CMS MS
Post by: burnacid on January 31, 2011, 02:15:29 PM
Well im making a module for CMS Made Simple
So first all content from the CMS is loaded and then a script basicly gets included into the page

So what i get from this is that also SMF is not capible of integration into CMS MS
Title: Re: Forum integration in CMS MS
Post by: Arantor on January 31, 2011, 02:19:08 PM
You would have to modify the CMS loader to include SMF in it, rather than trying to include it in the page as you're doing.
Title: Re: Forum integration in CMS MS
Post by: burnacid on January 31, 2011, 02:20:48 PM
Well thats not happening, so another forum that i can throw away
Title: Re: Forum integration in CMS MS
Post by: Arantor on January 31, 2011, 05:20:00 PM
If you can't modify the CMS loader, I can't see you being able to bridge it with ANYTHING other than a custom built forum for that CMS, since every forum software out there has session management that's going to interfere.