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.

user image gravatar plugin question for v2

bobthemanbobtheman
edited April 2010 in Vanilla 2.0 - 2.8
i have the user image gravatar plugin on v2 and im wondering like on vf.org how users without an uploaded image have the default image.. how this works. For me users without an image have like a image of there name in a box.. it looks weird.

Comments

  • MarkMark Vanilla Staff
    There is an included default.gif file in the plugin. Gravatar is supposed to use that gif if it doesn't find an associated gravatar. Check out line 72 of Gravatar/default.php.
  • hum, the default image is there, and valid i can browse to the image and it shows.

    72 shows the default image is TRUE. but still not working correctly

    here i'll show you an example

    http://forums.sophistsociety.com

    @Mark
  • MarkMark Vanilla Staff
    Got it. I've fixed this in development. You can fix it in yours by changing line 72 to this:

    .'&default='.urlencode(Asset(Gdn::Config('Plugins.Gravatar.DefaultAvatar', 'plugins/Gravatar/default.gif'), TRUE))
  • thanks so much
  • MarkMark Vanilla Staff
    I take it that worked? :)
  • yes it worked. thanks again
  • Hi @Mark

    Using 2.0.17.8 I tried the above solution and it did not work, as it kept trying to find the secure gravatar server. Instead I hacked the code to:

    $User->Photo = property_exists($Object, $Photo) ? $Object->$Photo : '';
    // $Protocol = (strlen(GetValue('HTTPS', $_SERVER, 'No')) != 'No' || GetValue('SERVER_PORT', $_SERVER) == 443) ? 'https://secure.' : 'http://www.';
    if ($User->Photo == '' && property_exists($Object, $Email)) {
    $User->Photo = $Protocol.'http://www.gravatar.com/avatar.php?'
    .'gravatar_id='.md5(strtolower($Object->$Email))
    .'&default='.urlencode(Asset(Gdn::Config('Plugins.Gravatar.DefaultAvatar', '/plugins/Gravatar/default.gif'), TRUE))
    .'&size='.Gdn::Config('Garden.Thumbnail.Width', 40);

    As you can see i commented out the $Protocol line, and changed the $User->Photo line to refer to an absolute URL for Gravatar.

    All users that have not defined a picture now see the default image on my server. does this sound about right? I'm not sure why the default code in the plugin does not seem to work corrctly and I appreciate the last post to this was over a year ago, but could not seen any other way to get it working correctly

    thanks
Sign In or Register to comment.