title: How to get author's Gravatar url?
body: <p>I want the author's pic to appear in some part of the single.php page, and I used this code  I found somewhere on the wordpress stack exchange to get the URL of the author Gravatar in order to use the pic as a background image of a DIV  :</p>
  
  <p>This code in functions.php :</p>
  
  <pre><code>if ( function_exists('register_sidebar') )
      register_sidebar();
  add_theme_support( 'post-thumbnails' );
  add_image_size( 'related', 300 , 200 , array(bottom, right) ); 
  function get_avatar_url($get_avatar){
      preg_match("/src='(.*?)'/i", $get_avatar, $matches);
      return $matches[1]; };
  </code></pre>
  
  <p>And this in the single.php :</p>
  
  <pre><code>&lt;div style="background:url('&lt;?php echo get_avatar_url(get_avatar( $curauth-&gt;ID, 150 )); ?&gt;');"&gt; &lt;/div&gt;
  </code></pre>
  
  <p>The strange thing about it is that it returns the default "mystery man" avatar instead of the author's Gravatar, although the Gravatar is linked to the author account and it appears on the admin panel ! </p>
  
  <p>How can I solve this problem ?</p>