News:

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

Main Menu

SSI results in full website

Started by locutusweb, January 15, 2015, 05:30:53 AM

Previous topic - Next topic

locutusweb

Hi,

I am playing with SSI. Basically I want a SMF login box on my own php pages. The weird thing is that I alway get the full blown forum website instead of the simple login box.

I used this example (Yes, the "require" is set correctly in my case)

<?php
require_once('/path/to/forum/SSI.php');

if (
$context['user']['is_guest'])
{
ssi_login();
}
else
{
//You can show other stuff here.  Like ssi_welcome().  That will show a welcome message like.
//Hey, username, you have 552 messages, 0 are new.
ssi_logout();
}
?>


What am I overlooking?

Kindred

I believe that you also will need....

global $context;
Сл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."

locutusweb

Quote from: Kindred on January 15, 2015, 06:57:02 AM
I believe that you also will need....

global $context;

Sadly, no difference.

Tried this piece of code on a different SMF installation (same server) and it worked like a charm. I have ran a diff between both SSI.php's but there were no diffferences that could produce this behavior.

Arantor

Does your forum require users to be logged in?

locutusweb


Arantor

And? If your forum requires people to be logged in at all times, SSI will bump them to the login page unless you specifically tell it not to.

Before you call SSI.php, add this line:
$ssi_guest_access = true;

locutusweb

Quote from: Arantor on January 15, 2015, 10:44:26 AM
And? If your forum requires people to be logged in at all times, SSI will bump them to the login page unless you specifically tell it not to.

Before you call SSI.php, add this line:
$ssi_guest_access = true;
That's it! Works great now.

Thanks Arantor and Kindred.

Marked as solved!

Advertisement: