WordPress.org

Ready to get started?Download WordPress

Forums

Removing gravatar.com (9 posts)

  1. gwc_wd
    Member
    Posted 3 years ago #

    I would appreciate any tips to remove the ubiquitous connects to gravatar.com without disabling all avatars. I want to allow users to upload avatars but I explicitly discourage use of gravatars for privacy reasons.

    I found code that allows removal of other functions by way of custom.php (for example removing items from the user profile).

    Does anyone have any suggestions on how to go about removing the calls to gravatar.com or even replacing them with calls to a local directory or alternative url.

    There has to be some way to stop the arbitrary transmission of users email addresses to a service they do not use, doesn't there? It seems so basic a privacy thing. I actually think it breaks Privacy Laws in most jurisdictions to have these transmissions occurring without first having the consent of the user and I know it's a breach of Canadian Privacy Law. I think it would be a real downer to tell a user they must consent to the transmission of their email address to a service of which they may never have heard and which the site involved does not use.

  2. threestyler
    Member
    Posted 3 years ago #

  3. gypsie
    Member
    Posted 3 years ago #

    @gwc_wd

    This issue drives me mad. I find totally outrageous that there is no simple built in function to turn global gravatar off. Not only is the privacy concern issue, it also slows down my jquery calls that are waiting until the whole page loads in. I have no idea who cares to have global icon and to give unknowingly, without their consent their email address away.

    The above mention plugin doesn't solve the problem as calls to gravatar.com are not stopped. It is just sending requests with generic dummy email address.

    Another plugin out there that is available is called "add local avatar" but this is still no good as it uses only local avatar if they were uploaded. If not, it still calls gravatar.com for the rest of them. Even for dummy "mystery" man. How stupid is that.

    All I really want is LOCAL AVATARS ONLY. No calls to external websites (gravatar.com, twitter.com) at all. Maybe the only solution is to write one.

  4. mvisa
    Member
    Posted 3 years ago #

    Still no luck here?

    Exactly looking for the same thing. Add Local Avatar plugin is used, but i'd really like to disable ALL requests to gravatar.com or any other service.

  5. Arash
    Member
    Posted 3 years ago #

    Has anyone found a way to remove gravatar.com from wordpress?

  6. zeaks
    Member
    Posted 3 years ago #

    There's an option in settings > discussions at the bottom to turn Gravatars off. Not sure if this completely disables them but, I'm having trouble loading 2 of my sites right now waiting for Gravatar images to load, but my other with it disabled loads with no issues.

  7. Arash
    Member
    Posted 3 years ago #

    Thank you, but this will disable all avatars, not just Gravatars.

  8. niccol
    Member
    Posted 3 years ago #

    Well, I think that you just need to override the function get-avatar().

    To do this you put the following code in functions.php

    add_filter('get_avatar', 'get_no_gravatar', 1, 2);
    function get_no_gravatar( $id_or_email, $size = '96', $default = '', $alt = false ) {
       // put your new function in here
            $avatar = "<img alt='image_alt' src='#' class='avatar avatar-{$size} photo avatar-default' height='{$size}' width='{$size}' />";
    	return apply_filters('get_avatar', $avatar, $id_or_email, $size, $default, $alt);
    };

    That lot will break the gravitar and avitar retrieval I believe. You will need to write a little bit of code (put your new function here) which retrieves the avatar but not the gravatar. I don't use avatars or gravatars so I can't be bothered to work out that code :-)

  9. Fask
    Member
    Posted 2 years ago #

    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/avatar.png';
    
    	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() .'/images/avatar.png';
    	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() .'/images/avatar.png';
    
    	if( $image && strpos( $image, "gravatar.com" ) ){ 
    
    		return '<img src="' . $default . '" alt="avatar" class="avatar" width="60" height="60" />';
    	} else {
    		return $image;
    	}
    
    }
    add_filter('bp_get_signup_avatar', 'bp_remove_signup_gravatar', 1, 1 );

    The image that I am referencing doesn’t have to be a PNG. The size is 150×150. You may have to adjust the file name and/or path to your liking. This speeds up your site very much.

Topic Closed

This topic has been closed to new replies.

About this Topic