• Resolved don-daniello

    (@don-daniello)


    Using Jetpack for comments via Facebook profile, the avatar (profile picture) for a comment is still loaded via HTTP which causes a mixed content warning in the admin panel in the “Recent comments” widget.

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Rogier Lankhorst

    (@rogierlankhorst)

    If the mixed content fixer is active (data-rsssl marker in the source), the plugin probably loads the gravatar image through ajax after the page load.

    You can fix that by adding a few lines of code to your theme’s functions.php:

    add_filter( 'get_avatar', 'rsssl_fix_mix_content_avatar' );
    function rsssl_fix_mix_content_avatar($avatar, $id_or_email, $size, $alt, $args){
      return str_replace('http://', 'https://', $avatar);
    }
    Plugin Author Rogier Lankhorst

    (@rogierlankhorst)

    Did this work for you?

    Thread Starter don-daniello

    (@don-daniello)

    Not exactly:

    ArgumentCountError thrown
    
    Too few arguments to function rsssl_fix_mix_content_avatar(), 1 passed in public_html/wp-includes/class-wp-hook.php on line 300 and exactly 5 expected
    
    Plugin Author Rogier Lankhorst

    (@rogierlankhorst)

    I forgot the number of variables in the filter:

    add_filter( 'get_avatar', 'rsssl_fix_mix_content_avatar', 10, 5);
    function rsssl_fix_mix_content_avatar($avatar, $id_or_email, $size, $alt, $args){
      return str_replace('http://', 'https://', $avatar);
    }
    Thread Starter don-daniello

    (@don-daniello)

    Yes, that works now. Is there any better way to place it other than the theme? We’d like to be able to update the theme. Can you put this in the plugin?

    Plugin Author Rogier Lankhorst

    (@rogierlankhorst)

    Glad to hear that works.

    You can add it as a mu-plugin, create a php file in the mu-plugins folder, and add this code. Then it will run always.
    You can read how to do that here:
    https://gregrickaby.com/2013/10/create-mu-plugin-for-wordpress/

    I’ll have to take a look why this function does not return the https url by default when the site_url is https. If it’s a generic issue it is a candidate for addition. But as the next update is already scheduled for next week, this won’t be until September.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Jetpack’s FB-comment’s avatars are still loaded via HTTP’ is closed to new replies.