Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with Facebook Sign In with Google Sign In with OpenID Sign In with Twitter

In this Discussion

How to display user pictures/avatar?

edited June 2012 in Questions

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

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


    factoid: Most questions have been previously answered, try the search box first, please provide your Vanilla version Number!

    Peregrine's Addons - donations gladly accepted for "successful solutions" and addons - kind of like tipping a waiter at a restaurant

Answers

  • 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"/>';

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

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

  • 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!

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


    factoid: Most questions have been previously answered, try the search box first, please provide your Vanilla version Number!

    Peregrine's Addons - donations gladly accepted for "successful solutions" and addons - kind of like tipping a waiter at a restaurant

    johansonlocker
  • 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?

Sign In or Register to comment.