WordPress.org

Support

Support » Plugins and Hacks » Hacks » Change the default profile picture for users who don't have a Gravatar

Change the default profile picture for users who don't have a Gravatar

  • ido_doron
    Member

    @ido_doron

    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?

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Change the default profile picture for users who don't have a Gravatar’ is closed to new replies.