Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Where's the signout link located?

edited July 2006 in Vanilla 1.0 Help
Where's the signout link located in the files and is there anyway I can move it into the menu system along with dicussions/categories/search/account ?


  • lechlech Chicagoland
    it's under
    .Session {}
  • I know the CSS for it, but where in the PHP files is it located, because I want to move it around so it's attached to the menu object and not separate.
  • lechlech Chicagoland
    ahh, ok, wait for mark then :D
  • MarkMark Vanilla Staff
    I'm not going to tell you where it is in the files, because you shouldn't be touching it in the files. You can easily accomplish what you want with an extension: Create a new extension file called SessionTab.php. Add your extension info at the top of your file and then do this: if (in_array($Context->SelfUrl, array("all", "forum", "pages", "here"))) { if ($this->Context->Session->UserID > 0) { $Menu->AddTab(($Context->GetDefinition("SignOut"), "whatever", "leave.php", "SignOutClass", "", 5); } else { $Menu->AddTab(($Context->GetDefinition("SignIn"), "whatever", "signin.php", "SignOutClass", "", 5); } $Head->AddString("<style type=\"text/css\">.Session { display: none; }</style>"); }
  • There's a parse error in there mark, for the life of me, can't find it.
  • I'll take a stab at looks like there's too many ('s

    Try this instead:

    if (in_array($Context->SelfUrl, array("all", "forum", "pages", "here"))) { if ($this->Context->Session->UserID > 0) { $Menu->AddTab($Context->GetDefinition("SignOut"), "whatever", "leave.php", "SignOutClass", "", 5); } else { $Menu->AddTab($Context->GetDefinition("SignIn"), "whatever", "signin.php", "SignOutClass", "", 5); } $Head->AddString("<style type=\"text/css\">.Session { display: none; }</style>"); }
  • Hmm nope, doesn't show up in the menu...
  • Well, if it got rid of the parse errors, then my job is done. ;)
  • Okay from the looks of things the problem is here

    if (in_array($Context->SelfUrl, array("all", "forum", "pages", "here"))) { if ($this->Context->Session->UserID > 0) {

    Now no error is presented, but the menu doesn't show up because of it...
  • edited August 2005
    Ohhhhhhhh man I'm stupid, sorry mark. hahaha. ignore everything cept comment below..

    k, so yeah Undefined variable: this resulting from if ($this->Context->Session->UserID > 0) {
  • MarkMark Vanilla Staff
    Doh - sorry - I just wrote that on the fly :)
  • Is there a fix to this variable problem?
  • Well, the proper way to do it would be to make a class. But, for a quick hack you can probably just use $Context->Session->UserID instead.
  • edited August 2005
    This would be a bit more proper:
    class LoginThing {
      var $Name;
      var $Context;
      function LoginThing(&$Context) {
        $this->Name = "LoginThing";
        $this->Context = &$Context;
      function AddToHeader() {
        if (in_array($this->Context->SelfUrl, array("all", "forum", "pages", "here"))) {
          if ($this->Context->Session->UserID > 0) {
            $Menu->AddTab($this->Context->GetDefinition("SignOut"), "whatever", "leave.php", "SignOutClass", "", 5);
          } else {
            $Menu->AddTab($this->Context->GetDefinition("SignIn"), "whatever", "signin.php", "SignOutClass", "", 5);
    $LoginThing = $Context->ObjectFactory->NewContextObject($Context, "LoginThing");
  • MarkMark Vanilla Staff
    Oh, and keep in mind that this:

    if (in_array($this->Context->SelfUrl, array("all", "forum", "pages", "here"))) {

    Needs to be changed to the actual page names that you want the signout/in button on (implied by "all forum pages here), like this:

    if (in_array($this->Context->SelfUrl, array("index.php", "comments.php"))) {

    that would add it to the discussion list and the comments page - and nothing else.
  • Yep. Got it to work perfectly, thanks guys.
  • I tried this in the new version and can't get it to work. I get these errors: Notice: Undefined variable: Context in D:\Program Files\xampp\htdocs\Vanilla.1\extensions\SessionTab\default.php on line 21 Notice: Trying to get property of non-object in D:\Program Files\xampp\htdocs\Vanilla.1\extensions\SessionTab\default.php on line 21 Line 21 is the "if (in_array" line. Should it be able to work? I am pretty new with the Vanilla forum, but find it excellent.
  • MarkMark Vanilla Staff
    This discussion is from August of 2005 and obviously not relevant any longer.

    Why don't you start a new discussion outlining your problem?
This discussion has been closed.