Skip to:
Content
Pages
Categories
Search
Top
Bottom

Speed up BBPress – remove gravatars – solution


  • kriskl
    Participant

    @kriskl

    After weeks trying to find something that would work, I found the code on wordpress forums to remove completely gravatars (and redirects it was causing.. )

    here is it:

    
    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() .'/images/mystery-man.jpg';
    	if( $image && strpos( $image, "gravatar.com" ) ){ 
    		return '<img src="' . $default . '" alt="avatar" />';
    	} 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() .'/images/mystery-man.jpg';
    	return "<img alt='{$alt}' src='{$default}' height='{$size}' width='{$size}' />";
    }
    
    add_filter('get_avatar', 'remove_gravatar', 1, 5);
    
    function bp_remove_signup_gravatar ($image) {
    	$default = get_stylesheet_directory_uri() .'/images/mystery-man.jpg';
    	if( $image && strpos( $image, "gravatar.com" ) ){ 
    		return '<img src="' . $default . '" alt="avatar" width="60" height="60" />';
    	} else {
    		return $image;
    	}
    
    }
    add_filter('bp_get_signup_avatar', 'bp_remove_signup_gravatar', 1, 1 );
    
    

    As I am now planning to disable buddypress completely. I am looking for an easy way to let users upload their avatars in bbpress, anyone tried it already?

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