TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

Members
Stats
  • Total Posts: 196,004
  • Total Topics: 21,330
  • Online today: 500
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 0
  • Guests: 459
  • Total: 459

Question: How can I require Login to view a specific Article?

Started by Zhorne, March 28, 2008, 07:14:53 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Zhorne

Hi,
  You know the nice login form response you get from SMF, perhaps after following a link from a new post notification, when you're trying to view a board/topic that requires authentication?

  I'm wrangling with how to accomplish this inside a PHP Article.  I've got the following code:


global $context, $user_info;

if ( $context['user']['is_guest'] )
{
// make user login or register

        echo "<center>";
$_SESSION['login_url'] = $_SERVER['PHP_SELF'] . '?page=21';
ssi_login();
        echo "</center>";
exit;
}
else
{

         // display article's html

}


But it's just not cutting it.  The SSI Login is bland and doesn't have the nice features that the login as described above gives the user.

I've tried all sorts of methods to call the login function in Sources/loginout.php, but none of them seem to work.  What am I missing, what's the correct way to accomplish this?

Thanks!

Ianedres

I made a page (with Dreamweaver to avoid having to echo out the HTML) in which I use the include() statement within the is_guest portion of the if/else clause. I put some information about the benefits of being a registered member and why I require it, then display the login.

Very similar to what you're already doing- but you could provide a link to register in the included page also...

Zhorne

well, I specifically want to get away from the SSI call, and use the call that generates whatever you normally get when you try and access a page which requires authentication. 

Like what you get here http://councilofelders.net/index.php?board=8.0

This website is proudly hosted on Crocweb Cloud Website Hosting.