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

add link in about 2.3.1

GotchaGotcha New
edited September 2017 in Vanilla 2.0 - 2.8

I am working on a theme and in the about page it shows username visits etc, when using sso I assume it takes your ID from your main site and places it in the forums db so that you have the same user id across the board. well i want to put a link but in the about like this,

<a href=http://mainsite.com/siteprofile/{ID}">Site Profile

I have added the link My question how can i echo the ID of the user in the link?

Comments

  • Options

    I got this to echo the user name

    <?php echo htmlspecialchars($this->User->Name); ?>

    but when i try this

    <?php echo htmlspecialchars($this->User->ID); ?>

    nothing

  • Options

    UPDATE!

    Got this to work!!

    <?php echo htmlspecialchars($this->User->UserID); ?>

    but after looking through the database I need the ForeignUserKey, I tried this

    <?php echo htmlspecialchars($this->User->ForeignUserKey); ?>

    but returned blank

  • Options
    R_JR_J Ex-Fanboy Munich Admin

    The User object only holds the values that you can find in the User table. What you are looking for is part of the UserAuthentication table. You need to connect both information. Basically you would need to do the following

    $userAuthentication = Gdn::sql()->getWhere(
        'UserAuthentication',
        [
            'UserID' => $this->User->UserID,
            'ProviderKey' => 'YourSSOProvider'
        ]
    )->firstRow();
    
    echo $userAuthentication->ForeignUserKey
    
Sign In or Register to comment.