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

How to display user pictures/avatar?

Hi everyone,
What's the smarty tag to display an user avatar? In a related question, the Gravatar plugin doesn't seem to work in the Profile view. Is there any fix for that?

Best Answer

  • Options
    peregrineperegrine MVP
    Answer ✓

    Try scanning some my other questions - messages on the page relating to Smarty. Sometimes your answer is other user's questions :). My attempt to change "user question myopia" where they focus only on questions they want answered.

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

Answers

  • Options
    edited June 2012
                      $HTTPS = GetValue('HTTPS', $_SERVER, '');
                      $Protocol =  (strlen($HTTPS) || GetValue('SERVER_PORT', $_SERVER) == 443) ? 'https://secure.' : 'http://www.';
    
                      $url = $Protocol.'gravatar.com/avatar.php?'           
                         .'gravatar_id='.md5(strtolower($Row->Email))
                         .'&d=monsterid'
                         .'&size='.C('Garden.Thumbnail.Width', 50);   
    

    echo '<img src="'.$url.'" class="ProfilePhotoSmall"/>';

  • Options

    Hi @johansonlocker. Thanks for the quick response. I'm completely new to Vanilla, and honestly, I have no idea what I'm supposed to do with your code.

    I'm modifying the default.master.tpl view, and as far as I've been able to deduce, I can't use PHP code in there.

    What I'm trying to do is to have a small banner in my forum saying "Welcome [User Name]", displaying their Profile pic (preferably Gravatar), and links to their profile, inbox, etc.
    I have found ways to display user name {$User.Name}, I know how to print out the profile links, but I can't seem to find how to display the User's profile pic.

    Any help would be appreciated.

  • Options
    edited June 2012

    Hi, @triddent222

    really I don't remember any banners with welcome text for user in forum. maybe because i use login integration with site? hm..

    At first try to find the file in \forum\ directory where You see these strings or a place where variable with the text is coded in php.

  • Options

    Oh I see. What site are you integrating with? I tried to embed my forum in Wordpress, but I got so many issues I thought it wasn't worth it. Do you know of any guides that could help me with embedding the forum? I think that would make what I'm trying to do much easier.

    Thanks!

  • Options

    hand-made site, i use deprecated plugin http://vanillaforums.org/addon/proxyconnect-plugin :)

  • Options

    triddent222 said:
    Oh I see. What site are you integrating with? I tried to embed my forum in Wordpress, but I got so many issues I thought it wasn't worth it. Do you know of any guides that could help me with embedding the forum? I think that would make what I'm trying to do much easier.>

    Thanks!>

    If you don't need to embed - I would avoid it - you will be much happier.

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • Options

    johansonlocker said:
    hand-made site, i use deprecated plugin http://vanillaforums.org/addon/proxyconnect-plugin :)

    Yes, I tried both JsConnect and Proxyconnect with Wordpress, and Proxyconnect works 'better'.

    peregrine said:

    If you don't need to embed - I would avoid it - you will be much happier.

    That was my same conclusion :(.

    Anyway, is there a Smarty tag to display profile pics? Or can I create a new {asset} to include some PHP into my template?

  • Options
    peregrineperegrine MVP
    Answer ✓

    Try scanning some my other questions - messages on the page relating to Smarty. Sometimes your answer is other user's questions :). My attempt to change "user question myopia" where they focus only on questions they want answered.

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

Sign In or Register to comment.