How To Load Gravatar on the Fly


Sponsored Links






Gravatar become very popular image recognition, it’s small image displayed almost on my WordPress Themes. After acquired by Automattic, Gravatar seamless integrated in WordPress.com. And for WordPress.org users, there are some ways to displayed on their site/blog. We can manually insert code into themes or using Gravatar Plugins.

Load Gravatar on the fly - Marie Digby

Load Gravatar on the fly - Marie Digby

I will show you how to Load Gravatar Icon/Images on the fly using Javascript on your WordPress Comment, This code original design by Stephen Mcintyre. Let’s get started, you need to added this code in your comment form on comments.php

<img id="gravatar" src="http://www.gravatar.com/avatar/?s=80&d=wavatar&quot; width="80" height="80" alt="Gravatar" />

Image code below is the on the fly area on the Gravatar will be, and wavatar parameter is to displayed random wavatar, if there are no email available.

Next Step is added extra JavaScript to call MD5 gravatar and load it on the fly

<script type="text/javascript" src="<?php bloginfo('template_directory'); ?>/webtoolkit-md5.js"></script>
<script type="text/javascript">

var gravatar = document.getElementById('gravatar');

var email = document.getElementById('email');

email.onblur = function(e){
    var key = MD5(email.value);
    gravatar.src = 'http://www.gravatar.com/avatar/'+key+'?s=80&d=wavatar';
};

</script>

Please noted, you need to download webtoolkit-md5.js from WebToolkit and put it on your current themes folder. You need to put this code below your WordPress comment email field to make it work.

That’s all save it and you can test it your comment right now. For live tester, you can leave some comment on this site and check it, our Load Gravatar on the fly worked ;)

Subscribe to Full RSS Feed

RSS FeedIf you thing this article useful, please consider subscribing to our RSS Feed or e-mail updates and stay updated with us. You can also follow @WPTricksNet on twitter for latest updates.

About WP Tricks

We are WordPress Family, we collected and writed useful tips and tricks for you WordPress. We share it for you...

Related Tips and Trick from Local Data and on The Net

The Right Way to Change The Default Gravatar in WordPress

I will show you How to Change the Default Gravatar in WordPress, why? Because one of my favourite WordPress Comment enhancement is added Gravatar, after Gravatar become Automattic Family, Gravatar become more and more better. Especially integrated with many many … Read More

Get Recent Comment with Gravatar without plugin

Many WordPress User need to display Recent Comment on the sidebar or footer with Gravatar, most of them using plugin, right now I will show you how to Get Recent Comment with Gravatar without plugin. All need to do just … Read More

Download Gravatar Widget Plugin

I love and really enjoy Gravatar, we can simply display our avatar or photos in our site and of course on WordPress. Download Gravatar Widget plugin for WordPress. This plugin is the easiest ways to diplay our gravatar on our … Read More

Remove the link to parent pages when using wp_list_pages as WP Navigation

How to remove the link to parent pages when using wp_list_pages in WordPress navigation is today tips that we want to share. This code original by Digital Forum user and shared by WP Garage. This tricks using pure jQuery, how … Read More

Add Facebook Share button on WordPress

Did you know that, there are so many ways to add Facebook Share button on WordPress, I will tried to coverage some of them. The first method is using standard facebook share button, or we can said it Faebook Sharer … Read More

How To Add a Copyright Notice to Copied Text on WordPress

For some reason, we want to added extra copyright information, when some reader or internet user copy our content. This code using Pure JavaScript and written by Batovasan on this post. I will try to rewrite this code on this … Read More

cerita seru 17th - WordPress Tricks & Tips

I will show you how to Load Gravatar Icon/Images on the fly using Javascript on your WordPress Comment, This code original design by Stephen Mcintyre. read more

Source: http://wptricks.net/archives/cerita-seru-17th

pule mari ro - WordPress Tricks & Tips

Posted on May 8, 2010 by WP Tricks Category Tricks Tagged Gravatar, Hack, JavaScript, Load, marie digby, On The Fly 12 Responds read more

Source: http://wptricks.net/archives/pule-mari-ro

Gravatar-Powered Profiles — Blog — WordPress.com

It takes forever for the Gravatar page to load and it keeps trying to close done my Because what I’d like is a way to turn G. off or on on-the-fly, for read more

Source: http://en.blog.wordpress.com/2010/03/26/gravatar-powered-profiles/

Chicken Wings Comics - Done loading cargo

I guess all of you who fly for a living won’t find I’ve once read somewhere that if you load all NAME — Get a Gravatar. EMAIL — Required / not published read more

Source: http://www.chickenwingscomics.com/?p=619

Wordpress Plugin: Wavatars - Twenty Sided

If you like, it can show the Gravatar for a given user (if available By Load WordPress Gravatars on the Fly « Stephen McIntyre on May 6, 2010 at 6:22 pm read more

Source: http://www.shamusyoung.com/twentysidedtale/?p=1462


12 Responses to How To Load Gravatar on the Fly

  1. Good post. I see you have already integrated the code into your site, nice job! :)

    However, the process isn’t quite as simple as you put it in this article, and takes some tweaking (giving the email field the ‘email’ ID for example) to make it work.

    Very nice implementation though, this is exactly what I had in mind.

    • WP Tricks says:

      Thanks you Stephen, in our tutorial is what’s exactly I did in this site, why we not put email input? mostly comment email input is the same is on your tutorial. I will update the tutorial to tell everybody to put the javascript code below email input form on WordPress comment.

      Thanks you for you nicely tricks, this is what I really want and I hope this one useful for others….

  2. Pingback: Tweets that mention How To Load Gravatar on the Fly # WordPress Tricks & Tips -- Topsy.com

  3. Emily says:

    [...] This post was mentioned on Twitter by WordPress Tricks. WordPress Tricks said: RT @WPTricksNet How To Load Gravatar on the Fly http://goo.gl/fb/c8xeR #tricks #gravatar #hack #javascript #load [...]

  4. Amy says:

    Thanks you Stephen, in our tutorial is what’s exactly I did in this site, why we not put email input? mostly comment email input is the same is on your tutorial. I will update the tutorial to tell everybody to put the javascript code below email input form on WordPress comment.

    Thanks you for you nicely tricks, this is what I really want and I hope this one useful for others….

  5. Piseth says:

    This is good tips. thanks for sharing this little trick.

  6. Thanatos says:

    Thanks!
    Works like a charm!

  7. Lisa says:

    Is there a way to get rid of gravatar.com from wordpress and only use local avatars?

  8. Bojan says:

    Thanks!

  9. Hafid says:

    Nice tips…
    Well, I’ve question here, if I don’t sign account from gravatar.com… and when I leave my comment to other site, can my default gravatar load out there?
    Sorry my english not good.

  10. ray ban sale says:

    I leave my comment to other site, can my default gravatar load out there?
    Sorry my english not good.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>