Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I am using Sarah Gooding's workaround to replace the core mystery man graphic with a custom graphic. It does not work. It continues to render the core mystery man graphic.

Has anyone had any success overwriting the mystery man graphic?

// Source: http://wpmu.org/how-to-add-a-custom-default-avatar-for-buddypress-members-and-groups/

function myavatar_add_default_avatar( $url ) {

    return get_stylesheet_directory_uri() .'/images/mystery-man.jpg';

}
add_filter( 'bp_core_mysteryman_src', 'myavatar_add_default_avatar' );

Tried this too (got it from http://etivite.com/api-hooks/buddypress/trigger/apply_filters/bp_core_mysteryman_src/).

It did not work either:

apply_filters( 'bp_core_mysteryman_src', 'myavatar_add_default_avatar' );
share|improve this question
add comment

1 Answer

I've used this code on my own BuddyPress site. Works like a charm!

// Use a better image than default mystery man
function bp_custom_set_avatar_constants() {
   define( 'BP_AVATAR_DEFAULT', get_stylesheet_directory_uri() . '/images/mystery-man.jpg' );
   define( 'BP_AVATAR_DEFAULT_THUMB', get_stylesheet_directory_uri() . '/images/mystery-man-50.jpg' );
}
add_action( 'bp_init', 'bp_custom_set_avatar_constants', 2 );

Add this to your bp-custom.php file, or, if you're developing a theme, to your theme's functions.php file.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.