Use Your Own Custom Images As Your WordPress Profile Image Instead Of The Default Gravatar

Use Your Own Custom Images As Your WordPress Profile Image Instead Of The Default Gravatar

Recently the plugin WP User Avatar decided to switch over to a completely new membership based plugin with the new update. And without warning installed this new plugin and all its functionality when most people just wanted the plugin to change their Avatars.

Let’s just say this didn’t sit well with most people.

https://wordpress.org/support/plugin/wp-user-avatar/reviews/?filter=1

OPPS!!!

Kinda feel sorry for them in a way but what a bad decision to make not sure what they where thinking. I have used this plugin on a few sites mainly because I thought why reinvent the wheel.

So after this crazy update I built one myself in about an hour.

Get the plugin from here.

https://github.com/samueleastdev/Custom-WP-Profile-Image-No-Gravatar

It is super simple you can upload a custom profile image through your profile page within WordPress. It also has the functionality to add a profile image through Woocommerce profile page.

The code is supper simple, WordPress has a filter to change the profile images get_avatar_data.

function seap_change_avatar($args, $id_or_email) {

	$args['url'] = 'https://images.pexels.com/photos/35183/people-homeless-man-male.jpg?auto=compress&cs=tinysrgb&dpr=2&h=650&w=940';

    return $args;

} 

add_filter('get_avatar_data', 'seap_change_avatar', 100, 2);

This is how it started the rest is obvious create an uploader and save the data as user meta etc.

If you profile picture is not showing make sure it is set to show in the WordPress welcome panel options or simple add this to a stylesheet css.

.user-profile-picture {
      display: table-row !important;
}  

If you want to contribute to the plugin create a pull request via GitHub.

Leave a comment