Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- add_action( 'wp_set_comment_status', 'wi_comment_notification', 99, 2 );
- function wi_comment_notification( $comment_id, $comment_status ){
- $comment_object = get_comment( $comment_id );
- if( $comment_status == 'approve' && $comment_object->comment_parent > 0 ){
- $comment_parent = get_comment( $comment_object->comment_parent );
- $mailcontent = 'Hi ' . $comment_parent->comment_author . ',<br><br>';
- $mailcontent .= $comment_object->comment_author . ' replied to your comment on <a href="' . get_permalink( $comment_parent->comment_post_ID ) . '">' . get_the_title( $comment_parent->comment_post_ID ).'</a> with the following:';
- $mailcontent .= '<blockquote>' . $comment_object->comment_content . '</blockquote>';
- $mailcontent .= 'See their comment and reply: <a href="' . get_comment_link( $comment_object->comment_ID ) . '">' . get_comment_link( $comment_object->comment_ID ) . '</a><br><br>';
- $headers = 'MIME-Version: 1.0' . "\r\n";
- $headers .= 'Content-type: text/html; charset=UTF-8' . "\r\n";
- $headers .= 'From: Wired Impact Blog <xxxxx@wiredimpact.com>' . "\r\n";
- wp_mail( $comment_parent->comment_author_email, 'New Reply to Your Blog Comment', $mailcontent, $headers );
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement