Closed. This question is off-topic. It is not currently accepting answers.
Your question should be specific to WordPress. Generic PHP/JS/HTML/CSS questions might be better asked at Stack Overflow or another appropriate site of the Stack Exchange network. Third party plugins and themes are off topic.
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' );
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.