Support » Fixing WordPress » Actual Gravatar URL for WP 2.6

  • WordPress 2.6’s Gravatar function (as seen below) currently spews out the img html tag.
    <?php echo get_avatar( $comment, $size = '16' ); ?>

    Is there a way I can get the direct URL to the image with the core WP functions or by adding some simple lines to my theme functions?

Viewing 5 replies - 1 through 5 (of 5 total)
  • you want something other than this?

    or what?


    Yes, that is exactly what I want. But here’s the problem, The function outputs it like this <img src=”…”>

    I want to echo just the actual url component. So for example I can make a link to the image.

    well, you can edit any of the other gravatar plugins for that purpose, I spose, if you know PHP, of course

    Theres just one, theres prolly more.

    actually, here:

    Plugin Name: Gravatar
    Plugin URI:
    Description: This plugin allows you to generate a gravatar URL complete with rating, size, default, and border options. See the <a href="">documentation</a> for syntax and usage.
    Version: 1.1
    Author: Tom Werner
    Author URI:
    2004-11-14 Fixed URL ampersand XHTML encoding issue by updating to use proper entity
    function gravatar($rating = false, $size = false, $default = false, $border = false) {
    	global $comment;
    	$out = "".md5($comment->comment_author_email);
    	if($rating && $rating != '')
    		$out .= "&amp;rating=".$rating;
    	if($size && $size != '')
    		$out .="&amp;size=".$size;
    	if($default && $default != '')
    		$out .= "&amp;default=".urlencode($default);
    	if($border && $border != '')
    		$out .= "&amp;border=".$border;
    	echo $out;

    thats fairly straight forward.

    Thanks, that was self explanatory. However I do wish WP had some more powerful core parameters to allow customizing the avatars further. I guess I’ll just need to add this function into the theme functions and call two functions to gob done!

    Hopefully they’ll add some more features regarding this for WP 2.6. It also might have been nicer if they kept Gravatars as an “official” plugin just like Akismet since both are Automattic products. That way I could just mod the plugins without having to worry about touching my core files.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Actual Gravatar URL for WP 2.6’ is closed to new replies.