Skip to:
Content
Pages
Categories
Search
Top
Bottom

Please can someome help me witha fix to this code setting it at global


  • keshabee
    Participant

    @keshabee

    /*Disable gravatar*/
    add_filter('bp_core_fetch_avatar_no_grav', '__return_true');
    
    /*Disable gravatar extra function*/
    function bp_remove_gravatar ($image, $params, $item_id, $avatar_dir, $css_id, $html_width, $html_height, $avatar_folder_url, $avatar_folder_dir) {
    
        $default = get_stylesheet_directory_uri() .'/_inc/images/bp_default_avatar.jpg';
    
        if( $image && strpos( $image, "gravatar.com" ) ){ 
    
            return '<img src="' . $default . '" alt="avatar" class="avatar" ' . $html_width . $html_height . ' />';
        } else {
            return $image;
    
        }
    
    }
    add_filter('bp_core_fetch_avatar', 'bp_remove_gravatar', 1, 9 );
    
    function remove_gravatar ($avatar, $id_or_email, $size, $default, $alt) {
    
        $default = get_stylesheet_directory_uri() .'/_inc/images/bp_default_avatar.jpg';
        return "<img alt='{$alt}' src='{$default}' class='avatar avatar-{$size} photo avatar-default' height='{$size}' width='{$size}' />";
    }
    
    add_filter('get_avatar', 'remove_gravatar', 1, 5);
    
    function bp_remove_signup_gravatar ($image) {
    
        $default = get_stylesheet_directory_uri() .'/_inc/images/bp_default_avatar.jpg';
    
        if( $image && strpos( $image, "gravatar.com" ) ){ 
    
            return '<img src="' . $default . '" alt="avatar" class="avatar" width="150" height="150" />';
        } else {
            return $image;
        }
    
    }

    Reasons being:
    The code helps to disable the gravatar use in buddy-press avatar and cover-image while also removing that gravatar text wordings when editing the avatar and cover image
    But the issue is am making use of a Buddypress Multiblog so this tend to cause issue with my avatar not being displayed in biography on post .

    Thanks in advance.

  • You must be logged in to reply to this topic.
Skip to toolbar