Skip to:
Content
Pages
Categories
Search
Top
Bottom

changing default avatar – codex info not working


  • hanza3
    Participant

    @hanza3

    I’ve setup my bp-custom.php file in the plugins folder, and inserted the code defined on this page of the codex to change the default avatar but nothing changed.

    Here’s the specific code to change the default avatar:

    define ( 'BP_AVATAR_DEFAULT', 'http://example.com/default-avatar.jpg' );
    define ( 'BP_AVATAR_DEFAULT_THUMB', 'http://example.com/default-avatar-thumb.jpg' );

    It seems I’m not the only one who has experienced an issue with this, any thoughts why it won’t work? Is gravatar somehow to blame?

    Tested with wordpress “twenty” theme, no change.

    Buddypress version: 2.9.3
    Wordpress version: 4.9.4

Viewing 3 replies - 1 through 3 (of 3 total)

  • Venutius
    Moderator

    @venutius

    Yep this looks like it’s broken, I’ve raised a trac ticket for it here.


    Jonas
    Participant

    @jonaskjodt

    You could probably do something like the following to achieve it as well

    function hanza3_add_default_avatar( $url ){
    	return get_stylesheet_directory_uri() .'/images/imagename.jpg';
    }
    add_filter( 'bp_core_mysteryman_src', 'hanza3_add_default_avatar' );

    Jonas
    Participant

    @jonaskjodt

    Digging into it a bit more, it seems gravatars influences it. You can disable the gravatars like so

    add_filter( 'bp_core_fetch_avatar_no_grav', '__return_true' );

    followed by using your original code

    define ( 'BP_AVATAR_DEFAULT', 'http://example.com/default-avatar.jpg' );
    define ( 'BP_AVATAR_DEFAULT_THUMB', 'http://example.com/default-avatar-thumb.jpg' );
Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.
Skip to toolbar