• Setup:
    After installing WordPress, I installed bbPress and integrated the two so users logged into WordPress can seamlessly transfer over to bbPress using their same account. To do this, I followed the setup instructions that bbPress provides you at installation. Additionally, I installed the bbPress Integration plugin and added the necessary code to my wp-config.php file. On top of that, I installed the Buddypress plugin as well.

    For the comments section, I’m currently calling a custom function from my comments template like this:

    <ul class="commentlist"><?php wp_list_comments('type=comment&callback=format_comment'); ?>
    </ul>

    And here is the function that is being called from functions.php:

    function format_comment($comment, $args, $depth) {
       $GLOBALS['comment'] = $comment; static $commentcount = 1;?>
       <li <?php comment_class(); ?> id="li-comment-<?php comment_ID() ?>">
    		<span class="comment-number">
    			<?php echo $commentcount++;?>
    		</span>
    		<?php
    			echo get_avatar(get_the_author_meta('user_email'), '48', '');
    		?>
    		<div class="comment-text">
    			<div class="comment-author">
    				<?php printf(__('<span>%s</span>'), get_comment_author_link()) ?>
    			</div>
    			<div class="comment-date">
    				<?php echo get_comment_date(); ?>
    			</div>
    			<?php if ($comment->comment_approved == '0') : ?>
    				<em><?php _e('Your comment is awaiting moderation.') ?></em>
    			<?php endif; ?>
    
    			<?php edit_comment_link(__('(Edit)'),'  ','') ?>
    
    			<?php comment_text() ?>
    		</div>
    <?php
            }

    Is there something wrong with this part?

    <?php echo get_avatar(get_the_author_meta('user_email'), '48', '') ;?>

    What I noticed:
    Everything seems to be working smoothly except for this avatar problem.
    However, when I log into the dashboard and go to the comments section, it shows the correct default avatar (Mystery man, Gravatar, etc.) for the posts I made as “Anonymous” (i.e. just filling out my name and fake email instead of being signed in).

    This is a huge problem for me and if anybody can shed some light on this, I’d really appreciate it.

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘When I post a comment as anonymous, the admin avatar shows up…’ is closed to new replies.