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.

Need help with two things (php code)

edited April 2007 in Vanilla 1.0 Help
Hi guys, I need help with some php code: - What's the code I need to put in the href attribute of an anchor to lead to the user's account page? (Like when you click on the account tab. I want to get rid of it and link the user's username in the #Session to the account page.) - What's the php code I need to put in the href that would lead the user to board's home? I don't want to hardcode my own since I'd like to make this style public.

Comments

  • edited April 2007
    with friendly url addon: "
    http://lussumo.com/community/account/".$Context->Session->UserID."/"
    normal :
    "http://lussumo.com/community/account.php?u=".$Context->Session->UserID

    its stored in : $Configuration['WEB_ROOT']
    so use it : $Context->Configuration['WEB_ROOT'])
  • edited April 2007
    Dang, I don't get it... :(

    This is too much for my designer brain to grasp... I guess I'm supposed to be editing something here (from menu.php):

    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'].'" class="Signout">'.$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>';

    But f*** if I know what to do... Basically all I want to do is link the username to the account page.

    PS

    Is there a way to make it friendly/query-visible URL scheme independent? I wouldn't like to break the functionality of the users who don't use the friendly URLs with this.
  • edited April 2007
    Dragan: we think alike--I just made this change myself for my own forum.

    This is what I did, added to the top of the extension file, but would work in conf/language.php also:$Context->Dictionary['SignedInAsX'] = 'Signed in as <a href="' . $Context->Configruation['BASE_URL'] . '/account' . ('Standard' == $Context->Configuration['URL_BUILDING_METHOD'] ? '.php' : '/' .'">//1</a>';
    You might want to change the CSS also, because the link doesn't appear to be a link other than when its hovered.
  • When I put your code WallPhone in language.php so it looks like this:
    <?php // Custom Language Definitions $Context->Dictionary['SignedInAsX'] = 'Signed in as <a href="'. $Context->Configruation['BASE_URL'] . '/account'. ('Standard' == Context->Configuration['URL_BUILDING_METHOD'] ? '.php' : '/' .'">//1</a>'; ?>
    It doesn;t work. :(

    Too bad, that would rock.
  • Whoops, that was my untested version. Try this: <?php // Custom Language Definitions $Context->Dictionary['SignedInAsX'] = 'Signed in as <a href="'. $Context->Configuration['BASE_URL'] .'account'. ('Standard' == $Context->Configuration['URL_BUILDING_METHOD'] ? '.php' : '/') .'">//1</a>'; ?>
  • edited April 2007
    Yaaaay! It works! :)

    Thank you so much WallPhone!
This discussion has been closed.