WordPress.org

Plugin Reviews

Add New Default Avatar [Emrikol's Fork]

This is my version of trepmal's "Add New Default Avatar" plugin. It has a few more features which I was looking for.

1 review
Average Rating
5 out of 5 stars
Do the job - Improvement for gender based avatar
By , for WP 4.5.3

Hi,

Effective plugin, thank you. I have found a piece of code which seems to set a default avatar based on the gender : Male / Female. Do you think you are able to adapt this code with your plugin?

add_filter( 'bp_core_fetch_avatar_no_grav', '__return_true' );
	function myavatar_add_default_avatar( $url )
	{
		global $bp;
		$gender = xprofile_get_field_data('Gender', bp_get_member_user_id());
		if ($gender == "Male") {
			return $img_url = SECU.'thefashionhero.com/wp-content/uploads/male_avatar.png';
		}
		else {
			return $img_url = SECU.'thefashionhero.com/wp-content/uploads/female_avatar.png';
		}
	}
	add_filter( 'bp_core_mysteryman_src', 'myavatar_add_default_avatar' );
	add_filter( 'bp_core_default_avatar_user', 'myavatar_add_default_avatar' );

You must log in to submit a review. You can also log in or register using the form near the top of this page.