Welcome to weSEO

Login

Welcome back, nice to see you again.

Register - it's free!

Comment, spread your love, communicate

Welcome back!

Nickname:

Password:

Lost your Password?

Create your new Account

Sign in with Twitter

Nickname:

Mailadress:

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!


Lovers

Avatar
Hans-PeterKgler - 24.01.2012 - 19:05
hi it doesn`t works on webspell 4.2.3a :/ any ideas ?
it shows only the noavatar.gif.. here my code:

if ($email = getemail($ds['userID']) AND !getemailhide($ds['userID'])) $email = str_replace('%email%', mail_protect($email), $_language->module['email_link']);
else $email='';
$gethomepage = gethomepage($ds['userID']);
if ($gethomepage != "" && $gethomepage != "http://" && $gethomepage != "http:///" && $gethomepage != "n/a") $hp = '<a href="http://'.$gethomepage.'" target="_blank"><img src="images/icons/hp.gif" border="0" width="14" height="14" alt="'.$_language->module['homepage'].'" /></a>';
else $hp='';

if(isonline($ds['userID'])=="offline") $statuspic='<img src="images/icons/offline.gif" width="7" height="7" alt="offline" />';
else $statuspic='<img src="images/icons/online.gif" width="7" height="7" alt="online" />';

$default = "http://".$hp_url."/images/avatars/noavatar.gif";
$avatar = '<img src="http://gravatar.com/avatar.php?gravatar_id='.md5(strtolower($ds['email'])).'&default='.urlencode($default).'&size=90" alt="Gravatar include fehlgeschlagen..." />';

if($loggedin && $ds['userID'] != $userID) {

Please Login to leave a Comment.

Sign in with Facebook Sign in with Twitter