• Resolved Toengel

    (@toengel)


    Hi,

    I have an issue with WP Avatar User when displaying AMP version of my blog.

    With these settings everything is ok:
    – NOT CHECKED: deactivate gravatar and use local avatars
    – CHECKED: Mystery MAN

    Now, when I deactivate gravatar, the following settings apply:
    – CHECKED: deactivate gravatar and use local avatars
    – CHECKED: WP User Avatar (is automatically chosen, when gravatar is deactivated)

    Now, when I save these settings, my AMP site has mixed content. Origin of this is the following “graphics”:

    https://secure.gravatar.com/avatar/14119858560729fa6c39a3af0c021f5c?s=24&d=wp_user_avatar&r=g

    1) why is gravatar.com still loaded, even if I deactivated gravatar?
    2) of course, this image is not available at this URL
    3) on the standard page (= not the AMP version) I don’t have any issue…

    My conclusion: your plugin seems to have an issue with AMP

    Can you please fix this?

    Toengel@Alex

    The page I need help with: [log in to see the link]

Viewing 5 replies - 1 through 5 (of 5 total)
  • Anonymous User 13882600

    (@anonymized-13882600)

    I have the same problem

    As far as I can tell ‘WP User Avatar’ only hooks into the get_avatar Filter. However some Plugins use get_avatar_data() or get_avatar_url() (which itself uses get_avatar_data). Imho WP User Avatar would need to hook into the filter get_avatar_data or at least get_avatar_url to be compatible with plugins that do not use get_avatar(). In the meta-author.php template from the Automattic AMP Plugin i see the usage of get_avatar_url(). Theoretically overloading that template in a childtheme (create a folder called amp within the childtheme and copy meta-author.php there) and replacing get_avatar_url() with get_avatar() combined with some code tweaking should do the trick as a work around. You could of course write your own function and hook into the filters i mentioned but that might take a bit longer to develop. Perhaps the WP User Avatar authors will introduce that feature in a future release.

    Forget about the overload. Put the following code into your child themes functions.php:

    add_filter( 'get_avatar_url', 'wpua_get_avatar_url', 50, 3 );
    function wpua_get_avatar_url( $url, $id_or_email, $args ){
    	if( class_exists('WP_User_Avatar_Functions') && $id_or_email != '[email protected]' ) {
    		global $wpua_functions;
    		$url = $wpua_functions->get_wp_user_avatar_src( $id_or_email, $args['size'] );	
    	}
    	return $url;
    }
    

    Working for me.

    Thread Starter Toengel

    (@toengel)

    Hi,

    AWESOME – you made my day!

    Toengel@Alex

    Great solution @mensmaximus, thank you!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Mixed Content on AMP version (still loading from gravatar.com)’ is closed to new replies.