How to Change BuddyPress Mystery Man Graphic without Overwriting Core Image File

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?

Read More
// 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' );

Related posts

Leave a Reply

1 comment

  1. 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.