I’m using the following:
<?php// Comment loop
if ($comments):
foreach ($comments as $comment):
// Test if Comment Author == Post Author
if ($comment->user_id == $post->post_author):
$CommentAuthorIsPostAuthor = True;
else:
$CommentAuthorIsPostAuthor = False;
endif;
// NoFollow sucks, we need an "alt" tag
$AuthorName = $comment->comment_author;
$AuthorURL = $comment->comment_author_url;
if ( ($AuthorURL == '') || ($AuthorURL == 'https://') ):
$AuthorData = "Comment by $AuthorName";
else:
$AuthorData = "Comment by <a href='$AuthorURL' alt='URL for comment author $AuthorName'>$AuthorName</a>";
endif;
?>
So this chunk of code does the following:
- Identify the author based on user id. This means you will only be identified as the author if are actually logged in. (keeping email high-jackers from being identified as the author erroneously).
- Allow for custom comment author links. In my case I’m adding an “alt” tag, and removing the “rel” tag.
Kevin