News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

Forum integration in CMS MS

Started by burnacid, January 30, 2011, 08:42:19 AM

Previous topic - Next topic

burnacid

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
hxxp:lan.burnacid.com/ [nonactive]


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("hxxp:lan.burnacid.com/index.php [nonactive]");
}else{
    ssi_login("hxxp:lan.burnacid.com/index.php [nonactive]");
}


Kindred

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
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

burnacid

Well also looked into that but its so unclearly explained.
No examples to found (atleast i didn't)

Arantor

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

Kindred

however, if he is looking to link the logins, te integration functions are probably a cleaner way to do that
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Arantor

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.

Kindred

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.
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

burnacid

#7
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("hxxp:lan.burnacid.com/index.php [nonactive]");
}else{
    ssi_login("hxxp:lan.burnacid.com/index.php [nonactive]");
}

Arantor

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.

burnacid

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

Arantor

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


Arantor

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

burnacid

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

Arantor

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.

burnacid

Well thats not happening, so another forum that i can throw away

Arantor

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.

Advertisement: