Skip to:
Content
Pages
Categories
Search
Top
Bottom

Customising default member avatar – Gravatar bug?


  • Marcella
    Participant

    @marcella1981

    I’ve managed to change to the default group avatar using this code I found on the web…

    function my_default_get_group_avatar($avatar) {
    	global $bp, $groups_template;
    
    	if( strpos($avatar,'group-avatars') ) {
    		return $avatar;
    	}
    	else {
    		$custom_avatar = get_stylesheet_directory_uri() .'/resource/img/stock/bp-lrg.png';
    
    		if($bp->current_action == "")
    			return '<img class="avatar" alt="' . attribute_escape( $groups_template->group->name ) . '" src="'.$custom_avatar.'" width="'.BP_AVATAR_THUMB_WIDTH.'" height="'.BP_AVATAR_THUMB_HEIGHT.'" />';
    		else
    			return '<img class="avatar" alt="' . attribute_escape( $groups_template->group->name ) . '" src="'.$custom_avatar.'" width="'.BP_AVATAR_FULL_WIDTH.'" height="'.BP_AVATAR_FULL_HEIGHT.'" />';
    	}
    }
    add_filter( 'bp_get_group_avatar', 'my_default_get_group_avatar');

    Changing the member avatar on the other hand doesn’t work when I use the constants as outlined in the codex.

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

    However it does render the image path.

    Here’s the output I get on member avatars.

    <img src="http://gravatar.com/avatar/c59b7f986d7329b747c3730012b50924?d=http://example.com/default-avatar.jpg&s=210&r=G" class="avatar user-4-avatar avatar- photo" width="210" height="210" alt="Profile picture of ">

    Surely all the gravatar.com stuff shouldn’t be present?

Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Customising default member avatar – Gravatar bug?’ is closed to new replies.
Skip to toolbar