• I am trying to change the default avatars for my site. I have used this code:

    // Add a default avatar to Settings > Discussion
    if ( !function_exists('fb_addgravatar') ) {
    	function fb_addgravatar( $avatar_defaults ) {
    		$myavatar = get_bloginfo('template_directory') . '/images/avatar.jpg';
    		$avatar_defaults[$myavatar] = 'Doc4';
    
    		return $avatar_defaults;
    	}
    
    	add_filter( 'avatar_defaults', 'fb_addgravatar' );
    } ?>

    Everything seems to be working as the name of the new avatar shows up in the discussion settings and in the source code the href of my image is correct. But alas no image shows up. The new default shows up as blank.

    And yes, I have named it avatar.jpg and placed it in the templates images file.

    Any ideas?

Viewing 7 replies - 1 through 7 (of 7 total)
  • Thread Starter schmacklab

    (@schmacklab)

    anyone?

    Got a link to the site, where there is a post using the default avatar?

    Having a similar problem. Using Prosumer theme and there is an avatar above the “About” on sidebar – can’t find where to delete and add my own avatar. I’m not a technie. Help??

    @schmacklab here’s my code

    if ( !function_exists('fb_addgravatar') ) {
        function fb_addgravatar( $avatar_defaults ) {
        $myavatar = get_bloginfo('template_directory').'/images/voodooEmpire.png';
        //default avatar
        $avatar_defaults[$myavatar] = 'The Voodoo Empire';
        return $avatar_defaults;
        }
     add_filter( 'avatar_defaults', 'fb_addgravatar' );
    }

    looks like yours…except one thing I guess
    ('template_directory').'/images/voodooEmpire.png';
    this line on yours….there appears to be a space between the dot and apostrophe before the path to the image

    I’m not so strong at this stuff, and have no clue if this matter?

    @pegalina
    not familiar with your theme, but WP doesn’t have a default option to allow you to upload your avatar. Natively, WP uses gravatar.com, you go to that website, upload your gravatar and WP will use it. If you have gravatar set up in settings->discussion

    You can also use plugins to allow avatar upload. Or have a swing with using the code we are discussing here. It goes in functions.php of your theme and sets a custom default avatar for any user who doesn’t have a gravatar

    Thank you RVoodoo – I think I misspoke. It’s probably not an avatar but an image that is above my About section on the sidebar. I just want to get rid of the default image and put something else in there. I think I may have to hire someone to do this since this seems WAY beyond my abilities, not knowing where to look for this…

    If you have any advice for me I’d appreciate it.

    Thanks!

    advice would be easier with a link to your site to take a peek

    Thread Starter schmacklab

    (@schmacklab)

    Hey everybody,

    Thanks for the feedback. No solutions yet it seems but here is link to a page on my site with comments at the bottom. I am meeting with my advisor tomorrow (i’m a student doing a WP independent study) so if he has any answers I’ll post them.

    https://www.schmacklab.com/2010/03/22/retaliation-book1-cornelius-and-ovy/

    Thanks!

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Problem Changing Default Avatars’ is closed to new replies.