• [MOD] User Gravatars 5 0 5 1
Currently:  

Author Topic: [MOD] User Gravatars  (Read 24446 times)

0 Members and 1 Guest are viewing this topic.

Offline Lucifix

  • Hero Member
  • *****
  • Posts: 710
    • View Profile
    • http://www.slo-foto.net
[MOD] User Gravatars
« on: January 29, 2009, 09:36:49 AM »
Description:
This simple MOD will add Gravatars in user comments, based on their 4images registered email and registration on Gravatar website: http://en.gravatar.com/

Screenshot:


What are Gravatars?
A gravatar, or globally recognized avatar, is quite simply an avatar image that follows you from blog to blog appearing beside your name when you comment on gravatar enabled sites. Avatars help identify your posts on web forums, so why not on blogs? (in our case 4images gallery):)
More: http://en.gravatar.com/

How to do it?
1.
- open templates/[your template folder]/comment_bit.html
- search:
Code: [Select]
<b>{comment_user_name}</b><br />
- after add:
Code: [Select]
{comment_user_gravatar}<br />
2.
- open details.php
- search:
Code: [Select]
$comment_user_ip = ($user_info['user_level'] == ADMIN) ? $comment_row[$i]['comment_ip'] : "";
- after add:
Code: [Select]
  $default_size = "50"; // width/height of avatars
  $default_rating = "G"; // An optional rating parameter may follow with a value of [ G | PG | R | X ] which determines the highest rating (inclusive) that will be returned.
      $md5 = md5( strtolower( $comment_row[$i][$user_table_fields['user_email']] ) );
  $comment_user_gravatar = "<img src='http://www.gravatar.com/avatar.php?gravatar_id=$md5&amp;size=$default_size&amp;rating=$default_rating' width='$default_size' height='$default_size' alt='' />";

-search:
Code: [Select]
"comment_user_ip" => $comment_user_ip,
- after add:
Code: [Select]
"comment_user_gravatar" => $comment_user_gravatar,
That's it! Enjoy!  :wink:
« Last Edit: March 21, 2009, 09:06:44 PM by Lucifix »

Offline flyfreak

  • Jr. Member
  • **
  • Posts: 63
    • View Profile
    • Flyfreak.dk
Re: [MOD] User Gravatars
« Reply #1 on: March 15, 2009, 12:57:15 PM »
Thanks!
Emil
Main site: www.flyfreak.dk
4Images site: www.flyfreak.dk/foto

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: [MOD] User Gravatars
« Reply #2 on: March 15, 2009, 01:18:49 PM »
very nice! somehow I've missed this mod...
Just yesterday I learned about gravatar site, and thought it was a good and innovative idea/concept.


In addition, if you don't want to see gravatar icon if no avatar available, you can add:
&amp;default=path to default avatar image
at the end of image address.

i.e.:
Code: [Select]
$comment_user_gravatar = "<img src='http://www.gravatar.com/avatar.php?gravatar_id=$md5&amp;size=$default_size&amp;rating=$default_rating&amp;default=".$script_url."/".TEMPLATE_PATH."/images/user_online.gif' width='$default_size' height='$default_size' alt='' />";
« Last Edit: March 15, 2009, 08:31:39 PM by V@no »
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline flyfreak

  • Jr. Member
  • **
  • Posts: 63
    • View Profile
    • Flyfreak.dk
Re: [MOD] User Gravatars
« Reply #3 on: March 15, 2009, 02:50:38 PM »
But iīve got som problems with this mod:

Example: http://www.flyfreak.dk/foto/img173.htm?l=English
The Gravatar donīt show my avatar - and i know that my avatar works, because i had tested it on many wordpress sites.
Emil
Main site: www.flyfreak.dk
4Images site: www.flyfreak.dk/foto

Offline Lucifix

  • Hero Member
  • *****
  • Posts: 710
    • View Profile
    • http://www.slo-foto.net
Re: [MOD] User Gravatars
« Reply #4 on: March 15, 2009, 06:29:55 PM »
Can you tell me what is your email? And the wordpress site where it shows your gravatar?

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: [MOD] User Gravatars
« Reply #5 on: March 15, 2009, 08:33:10 PM »
first of all, line:
	
  
$md5 md5strtolower$user_row_comment['user_email'] ) );


should be:
	
  
$md5 md5strtolower$comment_row[$i][$user_table_fields['user_email']] ) );


and second, my change above was incorrect. I've updated it with the correct one.
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline flyfreak

  • Jr. Member
  • **
  • Posts: 63
    • View Profile
    • Flyfreak.dk
Re: [MOD] User Gravatars
« Reply #6 on: March 16, 2009, 07:31:09 AM »
Can you tell me what is your email? And the wordpress site where it shows your gravatar?

http://www.larsbachmann.dk/velkommen-til-hvem-er-du.html
The comment from Emil at 17 January 2009 kl. 00:10




first of all, line:
	
  
$md5 md5strtolower$user_row_comment['user_email'] ) );


should be:
	
  
$md5 md5strtolower$comment_row[$i][$user_table_fields['user_email']] ) );


and second, my change above was incorrect. I've updated it with the correct one.

Thanks. I will try that
Emil
Main site: www.flyfreak.dk
4Images site: www.flyfreak.dk/foto

Offline desperate_housewif

  • Full Member
  • ***
  • Posts: 105
    • View Profile
Re: [MOD] User Gravatars
« Reply #7 on: March 21, 2009, 09:56:29 AM »
How can a user upload his image. It it possible directly in 4images, or must they turn into Gravatar.com to make there new gravatar?

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: [MOD] User Gravatars
« Reply #8 on: March 21, 2009, 10:00:15 AM »
Everything is done via gravatar.com
if you want users upload avatars directly to 4images, then you'll need install avatar mod.
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline flyfreak

  • Jr. Member
  • **
  • Posts: 63
    • View Profile
    • Flyfreak.dk
Re: [MOD] User Gravatars
« Reply #9 on: April 07, 2009, 07:29:10 PM »
How can i show the gravatar of an user in their profile?
Emil
Main site: www.flyfreak.dk
4Images site: www.flyfreak.dk/foto

Offline flyfreak

  • Jr. Member
  • **
  • Posts: 63
    • View Profile
    • Flyfreak.dk
Re: [MOD] User Gravatars
« Reply #10 on: April 09, 2009, 12:41:10 AM »
bump
Emil
Main site: www.flyfreak.dk
4Images site: www.flyfreak.dk/foto

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: [MOD] User Gravatars
« Reply #11 on: April 09, 2009, 04:14:08 AM »
How can i show the gravatar of an user in their profile?
In member.php find:
Code: [Select]
      "user_email" => $user_email,

Insert below:
Code: [Select]
      "user_email_orig" => $user_row['user_email'],


In templates/<your template>/member_profile.html add:
Code: (template/HTML+PHP) [Select]
<?php
$default_size 
"50"// width/height of avatars
$default_rating "G"// An optional rating parameter may follow with a value of [ G | PG | R | X ] which determines the highest rating (inclusive) that will be returned. 
$md5 md5(strtolower("{user_email_orig}"));
?>

<img src="http://www.gravatar.com/avatar.php?gravatar_id=<?=$md5?>&amp;size=<?=$default_size?>&amp;rating=<?=$default_rating?>" width="<?=$default_size?>" height="<?=$default_size?>" alt="" />
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline flyfreak

  • Jr. Member
  • **
  • Posts: 63
    • View Profile
    • Flyfreak.dk
Re: [MOD] User Gravatars
« Reply #12 on: April 15, 2009, 10:59:43 PM »
Thanks a lot  :D - i will test it soon!
Emil
Main site: www.flyfreak.dk
4Images site: www.flyfreak.dk/foto

Offline kremqun

  • Pre-Newbie
  • Posts: 1
    • View Profile
Re: [MOD] User Gravatars
« Reply #13 on: July 05, 2009, 02:12:06 PM »
Guys, can anyone tell me, how can i insert the gravatar of the image adder.
i mean in the section of {lang_added_by}{user_name_link}.

Offline surferboy

  • Full Member
  • ***
  • Posts: 142
    • View Profile
Re: [MOD] User Gravatars
« Reply #14 on: April 08, 2010, 02:03:41 AM »
Hi -

Was wondering if V@no's Avatar v2.01 would interfere with this MOD?  I saw his post in this topic string but was just wondering if we have a member who is a Gravatar user who then decides to upload another avatar on 4images if there would be a conflict, and also if he/she decides to unravel their personal avatar, if they can revert to the Gravatar once again.

Thanks for your thoughts.

Brian