LabSecrets Blog

The latest news & info from the Lab!

An alternative way to change the default member avatar for your site

Click for iPhone Video:

Thanks for the great tip from our client, Mike Henry Sr. at LeadChangeGroup, for an alternative way to provide a custom avatar instead of using the default “mystery-man”. Here is our our original post on swapping out the image file itself.

change-mystery-man


Full Code Below (registered members only):

[labprotect (Registered,Subscriber,LabSecrets)]

add_filter( ‘avatar_defaults’, ‘newgravatar’ );

function newgravatar ($avatar_defaults) {
    $myavatar = get_bloginfo(‘template_directory’) . ‘/images/labrats-gravatar.jpg’;
    $avatar_defaults[$myavatar] = "LabSecrets – Booyah!";
    return $avatar_defaults;
}

  • Change the name of the image file from "/labrats-gravatar.jpg" to whatever you want to call the image you upload. Be sure that it is sized to 128x128px and is a .jpg format. Be sure to upload this image file to your theme directory in the "images" folder.

    If you want, you can change the description text "LabSecrets – Booyah!" below as well.

functions-file-location
[/labprotect]

No comments yet.

Leave a Comment

Remember to play nicely folks, nobody likes a troll.

You must be logged in to post a comment.