Posted By

dubogii on 05/17/11


Tagged

email from user address Gravatar


Versions (?)

Display a User Gravatar from an Email Address


 / Published in: PHP
 

URL: http://css-tricks.com/snippets/php/display-a-user-gravatar-from-email-address/

  1. <?php
  2. $gravatar_link = 'http://www.gravatar.com/avatar/' . md5($comment_author_email) . '?s=32';
  3. echo '<img src="' . $gravatar_link . '" />';
  4. ?>
  5.  
  6. The variable "$comment_author_email" would be a string of a valid email address. If the email isn't in the Gravatar database, it will return a default graphic. "$comment_author_email" is the default WordPress variable that populates from a cookie for people who have previously commented (if the theme supports it).

Report this snippet  

You need to login to post a comment.