Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Using Vanilla Login on bespoke pages to authenticate users.

Hi everyone. My site has not yet launched but I've decided to use Vanilla as the Forum software. However, my site also has non-forum pages that I'd like to have members-only access.

I want to do all my user management using the Vanilla system, but have completely custom pages. How can I access the Vanilla login code so I can use it on my custom pages?

In order to check users are logged in, I'm using this code I found on another forum (http://photodune.net/forums/thread/vanilla-forums-authenticate-outside-forum/38138?page=1) and works great. So my only problem is getting users logged in, on my own pages.

Any help is much appreciated.

define('APPLICATION', 'Vanilla'); define('APPLICATION_VERSION', '2.0.16'); define('DS', '/'); define('PATH_ROOT', 'vanilla'); ob_start(); require_once(PATH_ROOT.DS.'bootstrap.php'); ob_end_clean(); // clear any header output from vanila $Session = Gdn::Session(); $Authenticator = Gdn::Authenticator(); if ($Session->IsValid()) { $Name = $Session->User->Name; echo "You are logged in as $Name"; }else{ echo "You are not logged in"; }

Sign In or Register to comment.