Skip to:
Content
Pages
Categories
Search
Top
Bottom

BP_AVATAR_DEFAULT_THUMB issue


  • @mcuk
    Participant

    @mcuk

    Hi all,

    define ( 'BP_AVATAR_DEFAULT', $img_url );
    define ( 'BP_AVATAR_DEFAULT_THUMB', $img_url );

    I’m using the code above to change the default avatar to a custom one from the usual mystery man. The first code works fine (and also seems to change the thumb avatars too).

    However the second avatar thumb code (which is meant to change the thumb avatars) does not seem to be having any effect, even with the first inactive.

    The code changing default avatar width and height works fine for both full size and thumb size avatars. It is just setting the BP_AVATAR_DEFAULT_THUMB where the problem lies.

    Any ideas?

    WP 4.4.2
    BP 2.5.1

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

  • danbp
    Moderator

    @danbp

    Hi,

    default avatar is ‘gravatar’ ‘s mytery man. To use your own avatar, you have to deactivate gravatar in addition to constant. Try this in bp-custom.php

    add_filter('bp_core_fetch_avatar_no_grav', '__return_true');
    define ( 'BP_AVATAR_DEFAULT_THUMB', 'YOURIMAGEURL' );

    @mcuk
    Participant

    @mcuk

    Hi @danbp,

    Thanks for reply. Yeah I’ve already got the gravatar code in bp-custom and all the define’s here work fine apart from the BP_AVATAR_DEFAULT_THUMB for some reason.

    Is define ( 'BP_AVATAR_DEFAULT', $img_url ); supposed to change thumbnail avatars too as that is what is happening (which seems to compensate for the thumb define not working but is odd)?

    In addition to that, are there equivalents for setting the cover-image dimensions? The closest I have come across is the filter apply_filters( 'bp_attachments_get_cover_image_dimensions', $wh, $settings, $component );. Is that the right one to use?

    Cheers


    danbp
    Moderator

    @danbp

    Have you tried both lines i indicated previously ?
    Also, what about thumbnail size in WP settings ? Have you checked that ?

    I’m not very well with attachments… But you’re proably right. See her for all bp_atachment references
    http://hookr.io/plugins/buddypress/#index=a&search=bp_attachments


    @mcuk
    Participant

    @mcuk

    Yeah I’ve got both lines in there already. Double checked by commenting out mine and copy paste yours too. To no avail though.

    Altering the thumbnail size (width/height) etc is fine, the defines work for those for both the full size and the thumb size. Its just changing the actual image of the thumbnail using define ( 'BP_AVATAR_DEFAULT_THUMB', $img_url ); .

    Came across this post from a couple of years ago where Henry has had the same issue it seems. Don’t know if it got resolved…

    https://buddypress.org/support/topic/bp_avatar_default_thumb-broken/


    brightwash
    Participant

    @brightwash

    define ( ‘BP_AVATAR_DEFAULT_THUMB’, $img_url );

    This was not working for me either, in the end this combination did. Turning off gravatar (first filter), and then a default bp image filter.

    
    add_filter( 'bp_core_fetch_avatar_no_grav', '__return_true' );
    add_filter( 'bp_core_default_avatar_user', 'override_default_avatar', 10, 2 );
    function override_default_avatar( $default, $params ) {
    	if ( !empty($params) ) {
    		if ( 'thumb' == $params['type'] ) {
    			return  get_stylesheet_directory_uri() . '/img/avatar-thumb.jpg'; 
    		} 
    	}
    	return  get_stylesheet_directory_uri() . '/img/avatar.jpg'; 
    }

    willy210385
    Participant

    @willy210385

    Hello. but how do I let my users view the photos you have uploaded to their profile BuddyPress completely disabling gravatar? thank you for support

Viewing 6 replies - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.
Skip to toolbar