comment_post_ID); // Check to see whether a comment is being approved if ($eoa_comment_status == 'approve' && $eoa_comment->comment_type == '') { // Get information about the currently logged in user, as the person approving the comment and thus the sender of the e-mail // Their name is mapped to $user_identity and their e-mail address is mapped to $user_email get_currentuserinfo(); $eoa_fromname = $user_identity; $eoa_fromaddress = $user_email; // Line break, which we will use many times in constructing e-mails $eoa_eol = "\r\n"; // Header stuff for an approved comment // Header stuff from http://ca.php.net/mail $eoa_headers = 'From: ' . $eoa_fromname . ' <' . $eoa_fromaddress . '>' . $eoa_eol; $eoa_headers .= 'Reply-To: ' . $eoa_fromname . ' <' . $eoa_fromaddress . '>' . $eoa_eol; $eoa_headers .= 'Return-Path: ' . $eoa_fromname. ' <' . $eoa_fromaddress .'>' . $eoa_eol; // E-mail subject for the approved comment $eoa_subject = '[' . $eoa_blogname . '] Comment on "' . $eoa_post->post_title. '" approved'; // Body of the e-mail $eoa_body = 'Hi ' . $eoa_comment->comment_author . ',' . $eoa_eol . $eoa_eol; $eoa_body .= 'Your comment on the post "' . $eoa_post->post_title . '" has been approved:' . $eoa_eol . $eoa_eol; $eoa_body .= '"' . $eoa_comment->comment_content . '"' . $eoa_eol . $eoa_eol; $eoa_body .= 'See the post here: ' . get_permalink($eoa_comment->comment_post_ID) . '#comment-' . $eoa_comment_id; // Send the notification e-mail for an approved comment wp_mail($eoa_comment->comment_author_email, $eoa_subject, $eoa_body, $eoa_headers); } } add_filter('wp_set_comment_status', 'eoa_comment_approved','',2); ?>