Advertisement
Guest User

Untitled

a guest
May 7th, 2015
260
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.24 KB | None | 0 0
  1. <?php
  2. add_action( 'wp_set_comment_status', 'wi_comment_notification', 99, 2 );
  3. function wi_comment_notification( $comment_id, $comment_status ){
  4. $comment_object = get_comment( $comment_id );
  5. if( $comment_status == 'approve' && $comment_object->comment_parent > 0 ){
  6. $comment_parent = get_comment( $comment_object->comment_parent );
  7.  
  8. $mailcontent = 'Hi ' . $comment_parent->comment_author . ',<br><br>';
  9. $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:';
  10. $mailcontent .= '<blockquote>' . $comment_object->comment_content . '</blockquote>';
  11. $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>';
  12.  
  13. $headers = 'MIME-Version: 1.0' . "\r\n";
  14. $headers .= 'Content-type: text/html; charset=UTF-8' . "\r\n";
  15. $headers .= 'From: Wired Impact Blog <xxxxx@wiredimpact.com>' . "\r\n";
  16.  
  17. wp_mail( $comment_parent->comment_author_email, 'New Reply to Your Blog Comment', $mailcontent, $headers );
  18. }
  19. }
  20. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement