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.
Options

Signed In As ... link in left side panel

byttebytte
edited October 2006 in Vanilla 1.0 Help
For my own board I'm looking to put the "Signed In As... (Sign Out)" link somewhere in the left side panel. What would be the best way to do this?

Comments

  • Options
    Try the GuestWelcome add-on.
  • Options
    That displays a message when a user is not logged in. I want it to display the username when logged in.
  • Options
    You could move the code for it, which is located in the top of themes/menu.php, over to panel.php.

    In the default file, this is what it looks like:

    echo '<div id="Session">'; if ($this->Context->Session->UserID > 0) { echo str_replace('//1', $this->Context->Session->User->Name, $this->Context->GetDefinition('SignedInAsX')).' (<a href="'.$this->Context->Configuration['SIGNOUT_URL'].'">'.$this->Context->GetDefinition('SignOut').'</a>)'; } else { echo $this->Context->GetDefinition('NotSignedIn').' (<a href="'.AppendUrlParameters($this->Context->Configuration['SIGNIN_URL'], 'ReturnUrl='.GetRequestUri()).'">'.$this->Context->GetDefinition('SignIn').'</a>)'; } echo '</div>';

    Notice the echo calls.

    You could do 1 of two things.
    First, for either, is to make copies of menu.php and panel.php
    (from the themes directory) and put them in the main directory
    for the theme you are using. For example, if your theme is called
    "MyTheme", you would copy them to themes/MyTheme/. If you're using
    either the default vanilla theme, or a theme you've downloaded, it's
    usually best to make a fresh copy of the them you're playing with.

    Anyway, once copied over, open up menu.php and look for the above
    mentioned code.

    Here's the easy options:

    1) You can either move that chunk of code over to panel.php, and insert
    it where you see fit.

    2) You can change the two echo's from " echo ' " to " $myvar = ' ".
    Then, add a global statement ( global $myvar;) at the top of that
    file under the " // Note: " line.

    Then, you would add the same global line to panel.php, and add:

    echo $myvar;

    in panel.php where you see fit.


    As a note, you might wish to remove the

    echo '<div id="Session">';

    and

    echo '</div>';

    lines, as the default css file will still stick it up in the upper right corner.

    You could put it in a span or p tag if you wish, or whatever.
  • Options
    Here is a way to do it in CSS: http://lussumo.com/community/discussion/3278/
  • Options
    Yeah, that would work too.
  • Options
    Thanks guys!
  • Options
    Additionally, is there a way to get it into an extension that builds list items like this: $titel = "Forum Pages And Options"; $Panel->AddList($titel, 10); $Panel->AddListItem($titel, "Start a new discussion", $Context->Configuration['WEB_ROOT'].'post/'); It would be cool if the login information was a list item there as well.
  • Options
    anyone that knows how I could pass variables to the default.php page of an extension?
  • Options
    nevermind, got it, using: $Context->Session->User->Name pretty obvious :)
This discussion has been closed.