Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

How can I fetch anyone’s gravatar image?

I need to show users gravatar image on a custom profile page that am making.

I have so far integrated the option of Facebook Profile Pic (which automatically gets grabbed) and also am allowing user to assign his/her own photo (on wish).

What I need to do is, if person do not comes from FB, then maybe his email or something should be used to see if he/she has a gravatar, if yes then display it. How can I do that?

Thanks.

share|improve this question

1 Answer 1

You can use get_avatar. The following example prints an avatar in 96 px, assuming that you have the user id stored in $user_id, and prints a fallback user.png if no such user or image could be found.

echo get_avatar($user_id, 96, get_stylesheet_directory_uri() . '/images/user.png');
share|improve this answer
    
i will implement it asap, and will revert back. thanks for the reply. –  vajrasar Feb 16 '13 at 10:49

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.