Change the default profile picture for users who don't have a Gravatar (1 post)

  1. ido_doron
    Posted 2 years ago #

    Hi, I want to replace the default "Mystery Man" profile picture with a different picture.

    As you know, you can access someone's Facebook profile picture by going to http://graph.facebook.com/<USER ID>/picture (replace <USER ID> with the UID of the requested account.

    So what I basically did was adding my theme's function file these few lines:

    add_filter( 'avatar_defaults', 'newgravatar' );  
    function newgravatar ($avatar_defaults) {
        $myavatar = 'http://graph.facebook.com/'.get_current_user_id().'/picture';
        $avatar_defaults[$myavatar] = "FB Profile Picture";
        return $avatar_defaults;

    The problem is that wordpress doesn't show this URL directly. It stores the picture on WordPress.com's servers. As a result, the picture is always the same picture and doesn't change when a different user logs in.

    Is there any way to prevent WordPress from caching the picture on their servers? Or is there any other way to do what I want to do?

Topic Closed

This topic has been closed to new replies.

About this Topic