Support » Plugin: Avatar Privacy » Author Profile Picture Missing

  • Resolved retropixel

    (@retropixel)



    Thank you so much for this Plugin!
    Unfortunately there seems to be an issue with it: The Author Profile Picture is now missing! There is only the “place holder” showed instead. The checkbox in my profile is activated. My Gravatar Picture is shown next to my comments, but not next to my Author Profile.

    Thanks for your help!

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

Viewing 12 replies - 1 through 12 (of 12 total)
  • Plugin Author pepe

    (@pputzer)

    Can tell me more about your Avatar settings? I’ll try to recreate the situation. Here’s what I’ve gathered so far:

    • You have enabled gravatars for your user.
    • You’ve got a gravatar image associated with your email address.
    • This image is showing with your comments.
    • The image is not showing the “Your Profile” screen.
    Plugin Author pepe

    (@pputzer)

    Ah, I’ve looked at the site and I think I know what you meant: You were talking about the “Über den Autor” box at the end of your posts? Are you using another plugin for that? Because the HTML looks a bit weird:

    <img src="https://[domain]/wp-content/uploads/2018/04/[hash].png" alt="" />								
    <img alt="" src="https://[domain]/wp-content/plugins/avatar-privacy/public/images/comment-bubble.svg" height="100" width="100" />

    There’s two separate image tags embedded there.

    • This reply was modified 6 months ago by  pepe.
    • This reply was modified 6 months ago by  pepe. Reason: removed gravatar hash & domain
    retropixel

    (@retropixel)

    No, I dont use a Plugin for this.

    <img src="https://[domain]/wp-content/uploads/2018/04/[hash].png" alt="" />

    This is the image I uploaded for the “WP User Avatar” Plugin. Pretty strange that this line is still there, because I deactivated (but not uninstalled) it.

    Plugin Author pepe

    (@pputzer)

    I thought it might be a hashing issue, but since you’ve changed the default icon to “Blank” and the second <img/> is still there, I would assume that it’s somehow hardcoded in the template? Could you post a snippet of the relevant template file?

    retropixel

    (@retropixel)

    you´re absolutely right – I found this in single.php:

    style="display:none;" src="http://www.retropixels.at/wp-content/uploads/2018/04/xxxxxxx.png" alt="" />';?>

    It seems that the plugin WP User Avatar has modified the single.php this way ?!
    So I Uploaded the original PHP File, which replaced theabove code with
    echo '<img itemprop="image" style="display:none;" src="http://gravatar.com/avatar/' . $hash .'" alt="" />';

    BUT: Still no Author-Picture 🙁

    Plugin Author pepe

    (@pputzer)

    I’m not sure what you intend to do with an <img> with style="display:none;"? Could you please include a snippet with the complete author box template? There should be a call to echo get_avatar(...); for the image and nothing else. I need to se the exact parameters to that get_avatar call, though.

    retropixel

    (@retropixel)

    Well, thats a good question. Cant answer that, because I´m not the Author of the Theme but it seems pretty senseless 😉

    Here is the complete code of the author-box :

    <!-- about the author -->
    <div id="author-block" class="box-shadow-2px clearfix" itemscope="" itemtype="http://schema.org/Person">
    <h2 class="author-title"><?php _e('About the author', 'color-theme-framework'); ?></h2>
    
    <div id="author-avatar">
    	<?php 
    	$user_email = get_the_author_meta( 'user_email' );
        	$hash = md5( strtolower( trim ( $user_email ) ) );
        	echo '<img itemprop="image" style="display:none;" src="http://gravatar.com/avatar/' . $hash .'" alt="" />';
    	?>
    	<?php echo get_avatar( get_the_author_meta( 'user_email' ), apply_filters( 'twentyeleven_author_bio_avatar_size', 100 ) ); ?>
    </div><!-- #author-avatar -->
    
    <div id="author-description" class="padding-20">
    	<meta itemprop="additionalName" content="<?php the_author_meta( 'first_name' ); ?> <?php the_author_meta( 'last_name' ); ?>">
    	<meta itemprop="url" content="<?php the_author_meta( 'user_url' ); ?>">
    	<p><?php the_author_meta( 'description' ); ?></p>
    
    	<?php ct_get_author_social(); ?>
    
    	<a style="font-size: 11px;" href="<?php echo get_author_posts_url(get_the_author_meta( 'ID' )); ?>"><?php _e('View all articles by ', 'color-theme-framework'); the_author_meta('display_name'); ?></a>
    	</div><!-- #author-description	-->
    </div><!-- #author-info -->
    Plugin Author pepe

    (@pputzer)

    You need to replace get_the_author_meta( 'user_email' ) with get_the_author_meta( 'ID' ), otherwise get_avatar() does not know you are looking for a user instead of an anonymous commenter.

    As for the hardcoded <img>, it’s probably there to provide the image meta data element for schema.org markup. However, it’s unnecessary. You can pass additional HTML attributes to the get_avatar() function directly. Please replace the “author-avatar” part (everything within the <div>) with this:

    
    <?php 
       echo get_avatar( get_the_author_meta( 'ID' ), apply_filters( 'twentyeleven_author_bio_avatar_size', 100 ), '', '', [ 'extra_attr' => 'itemprop="image"' ] ); 
    ?>
    
    retropixel

    (@retropixel)

    It works now perfectly! Thanks!

    I’m curious. Why does get_the_author_meta( 'user_email' ); not work?

    get_avatar can be used with ID *or* email, but I can confirm it is just working with ID.
    See also: https://codex.wordpress.org/Function_Reference/get_avatar

    Can you explain this further @pputzer? Thanks in advance!

    All the best,
    Torsten

    Plugin Author pepe

    (@pputzer)

    The problem is that Avatar Privacy needs to differentiate between anonymous comment authors and registered WordPress users to properly check for opt-in (and also to prevent fraudulent uses of the avatar image). Opt-in for users is stored in user_meta, opt-in for anonymous commenters in a separate table.

    Since Avatar Privacy 1.1, registered users can allow anonymous commenters to use their avatars (i.e. to allow logged-out commenting) via a checkbox in their profile pages.

    Plugin Author pepe

    (@pputzer)

Viewing 12 replies - 1 through 12 (of 12 total)
  • You must be logged in to reply to this topic.