• Resolved garywhite855

    (@garywhite855)


    When someone comments on my blog their email address is displayed with the comments. How can that be changed so it isn’t displayed. is it something in WordPresss or the theme (Amazing Grace theme)?

    I checked in the admin panel under Settings>Discussion but couldn’t see anything there.

    thanks!

    gary

Viewing 6 replies - 1 through 6 (of 6 total)
  • The easiest way to check if its WordPress of something other than the default themes is to check for the issue using the default themes.

    Do you see the same results in Kubrick (default) that you are seeing in Amazing Grace? As I suspect this will be theme related.

    Open the comments.php

    Find
    <?php wp_list_comments(); ?>
    Replace with
    <?php wp_list_comments('type=comment&callback=mycomments'); ?>

    Open the functions.php

    Add this at the top (or bottom, wherever you prefer).

    <?php
    function mycomments($comment, $args, $depth) {
       $GLOBALS['comment'] = $comment; ?>
    
    	<li <?php comment_class(); ?> id="li-comment-<?php comment_ID() ?>">
    		<div id="comment-<?php comment_ID(); ?>">
    			<div class="comment-author vcard">
    				<?php echo get_avatar($comment,$size='40',$default='<path_to_url>' ); ?>
    				<?php edit_comment_link(__('<small style="float:right">[ Edit ]</small>'),'  ','') ?>
    				<?php printf(__('<cite class="fn">%s</cite> <span class="says">says:</span>'), get_comment_author_link()) ?>
    			</div>
    			<?php if ($comment->comment_approved == '0') { ?><em><?php _e('Your comment is awaiting moderation.') ?></em><br /><?php } ?>
    			<div class="comment-meta commentmetadata">
    				<a href="<?php echo htmlspecialchars( get_comment_link( $comment->comment_ID ) ) ?>">
    					<?php printf(__('%1$s at %2$s'), get_comment_date(),  get_comment_time()) ?>
    				</a>
    
    			</div>
    			<?php comment_text() ?>
    			<div class="reply">
    				<?php comment_reply_link(array_merge( $args, array('depth' => $depth, 'max_depth' => $args['max_depth']))) ?>
    			</div>
    		</div>
    <?php
    }

    This basically creates a custom calback for comments, you’ll need this to style or redefine the comments area.

    Importantly, once you’ve added the above into the functions.php, see this line.
    <?php printf(__('<cite class="fn">%s</cite> <span class="says">says:</span>'), get_comment_author_link()) ?>
    Replace that with..
    <?php printf(__('<cite class="fn">%s</cite> <span class="says">says:</span>'), get_comment_author()) ?>

    Simply put, here’s what we’ve done…..

    1. Update the comments file to reference a callback.
    2. Add the callback function to the functions file.
    3. Update get_comment_author_link() to be replaced with get_comment_author().

    I hope that helps… ??

    Tested before posting (i use that theme to).

    Thread Starter garywhite855

    (@garywhite855)

    Thanks so much,

    I’ve tried inserting the code and I get an error message

    Parse error: syntax error, unexpected ‘<‘ ….. line 27

    I inserted at the top as recommended. In my editor window line 27 is the </div> after the near the bottom
    ie here:

    </div>
    <?php comment_text() ?>
    <div class=”reply”>
    <?php comment_reply_link(array_merge( $args, array(‘depth’ => $depth, ‘max_depth’ => $args[‘max_depth’]))) ?>
    </div>
    </div>
    <?php
    }

    In your text above line 27 is the final <?PHP

    Am I doing something wrong or is there a typo somewhere?

    appreciate the help!

    gary

    Try after …

    ...
                              </div>
    		</div>
    <?php
    }

    … adding …

    ?>

    Yes sorry, i should have included that..

    Thread Starter garywhite855

    (@garywhite855)

    Awesome!

    Thanks t31os and cais that’s perfect. You guys rock!

    marking as resolved

    gary

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Commentors emails displayed’ is closed to new replies.