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.

Check for logged in inside views/master.tpl

edited October 2009 in Vanilla 2.0 - 2.8
It appears to be undocumented, but is there a simple way to check for whether the user is logged in inside default.master.tpl or other views?

Comments

  • MarkMark Vanilla Staff
    @Todd would be the one to respond here (he set up the smarty templates). If you want to switch to a PHP master view instead, you can change the name to default.master.php and use this:

    http://vanillaforums.org/page/PHPMasterView

    And then you can check for an active session with:
    $Session = Gdn::Session();
    if ($Session->IsValid()) {
    // User is signed in!
    }
  • @Mark: Thanks that's exactly what I was looking for.
  • By the by for any of you Kohana devs out there, the handshaking is working without a hitch with my Kohana apps.

    The only thing I had to change was in the session config file, I had to change the $config['validate'] setting to 'expiration' though I'm still trying to iron out a bit better way, as I prefer the session validating to use 'user_agent'.

    But doing this, I've been able to let Vanilla do its thing and I can even have two different databases--one for my app, and one for Vanilla--and it works like a charm.

    Now I can continue to do everything I want with Kohana's brilliance and share it seamlessly with V2's brilliance.

    Altogether a much better experience than V1.

    Nice work, Mark!
Sign In or Register to comment.