Use Gravatar to make your Visitors life easier
![]()
Gravatar is an awesome service. With Gravatar you can get rid of the unpersonal "No Avatar"-Images as long as the Guest or User who did not upload an Avatar has a Gravatar-Account using the Email-address he also uses on your Site.
Your Gravatar is an image that follows you from site to site appearing beside your name when you do things like comment or post on a blog. Avatars help identify your posts on blogs and web forums, so why not on any site?
Implement it
Here is the Code for the Comments (News, ...) this is just to give you the Idea of how it is done.
Open comments.php and search for:
Code:
1. | $email = str_replace('%email%', mail_protect($ds['email']), $_language->module['email_link']); |
Add below:
Code:
1. 2. | $default = "http://".$hp_url."/images/avatars/noavatar.gif"; $avatar = '<img src="http://www.gravatar.com/avatar.php?gravatar_id='.md5(strtolower($ds['email'])).'&default='.urlencode($default).'&size=90" alt="Avatar" />'; |
This is the Code you have to use to show the Gravatar of the User. If the Email-address he provided is not connected to Gravatar your default "No Avatar" Image will be shown.
What now?
I hope you've got an Idea of how it is done. Implement it to you Site - maybe into the Forum, Guestbook, into all places where a Avatar of a User is shown and share the Files with us! Tweet

