or customize it with parameters: 1 = The link text (default: 'Email') 2 = Before the link (default: '') 3 = After the link (default: '') 4 = The email's subject. The string "%s" will be replaced by the title of the post (default: 'Reply to your comment on %s') 5 = The link's title (default: 'Reply directly to comment author'); 6 = Get only the URI? If you set it to true, it will only produce the href attribute's value. (default: false) 7 = The minimum user level to see the link. (default: 10) 8 = Display text with no link if the comment is a trackback (default: false) 9 = Echo the final output. If set to false, it will use a 'return' instead of an 'echo'. (default: true) */ function email_to_comment_author( $text='Email', $before = '', $after='', $subject='Reply to your comment on %s', $title='Reply directly to comment author', $getonlyuri=false, $minlevel=10, $display_text_even_if_its_a_trackback = false, $echo=true ) { global $comment, $post, $user_ID; $author_data = get_userdata($user_ID); /* Only allowed users can see emails... */ if ($author_data->user_level < $minlevel) { return false; } else { /* Get the post title */ $postname = $post->post_title; /* Create the subject string */ $subject = str_replace("%s",$postname,$subject); $subject = str_replace("\"",""",$subject); /* utf8_uri_encode() is the best WordPress function. */ $subject = utf8_uri_encode(str_replace(' ','%20',$subject)); /* Not used yet. Maybe it won't be used ever. */ $comment_body = $comment->comment_content; /* Get the comment author's email */ $email = $comment->comment_author_email; /* Create the href value */ $href = 'mailto:'.$email.'?subject='.$subject; /* Create the output */ if ($getonlyuri == true) { $output = $href; } else { $output = $before.''.$text.''.$after; } /* If it's not a trackback or a pingback, echo it. */ if ($comment->comment_type == '') { /* echo? */ if ($echo == true) { echo $output; } /* return? */ else { return $output; } } else { if ($display_text_even_if_its_a_trackback == true) { if ($echo == true) { echo $before.$text.$after; } else { return $before.$text.$after; } } } } } /* No filters! */ ?>