Contact Notification Emails Not Send After Comment Approval in WordPress

hi
when some one post in my blog, i (admin) get reply that some one posted, but when i approved that or reply on that, the poster dont get any notifications

so how will i be able to let poster know that there is a reply on his post ??

thanks
LVL 29
fosiul01Asked:
Who is Participating?
 
KysolConnect With a Mentor Commented:
The code snippet is a very simple piece, there's no validation and so on, but it's a proof of concept that works and you can build on it.

I wouldn't advise to use it outside of a development environment until you are 100% sure that all data has been sanitized. This is just an example to get you on the right track.
<?php
/*
Plugin Name: Comment Notification
Version: 1.0
Description: Adds Notification to Comments
Author: Kysol
*/

	/* Plugin Code */
		function comment_status_change( $id, $status )
		{
			if ( $status == 'approve' )
			{
				$comment = get_comment( $id );

				if ( $comment->comment_author_email )
				{
					wp_mail(
						$comment->comment_author_email,
						get_bloginfo( 'name' ) . ' - Comment Approved',
						'Your comment: "' . $comment->comment_content . '" has been approved.',
						''
					);
				}
			}

			return $id;
		}

	/* Wordpress Hooks */
		add_action( 'wp_set_comment_status',	'comment_status_change', 100, 2 );
?>

Open in new window

0
 
KysolCommented:
Personally I have no clue if it does send upon approval by default. If it doesn't you can use a hook:

wp_set_comment_status 
Runs when the status of a comment changes. Action function arguments: comment ID, status string indicating the new status ("delete", "approve", "spam", "hold").

add_action()

hope that helps.
0
 
fosiul01Author Commented:
do i have to add that code in wp_set_comment_status ??



another thing

like from word press admin section,

when i click on users post , there is a section call "Reply"

i thought, if i click on Reply, it will go to users inbox directly, but its does not, when i click on Reply and submit

its actually put my comments in the webstie rather then emailing to the users


so i want that as well..but dont know how

0
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
KysolCommented:
No you would have to write a plugin to fire off the add_action. I'll look into it now.
0
 
fosiul01Author Commented:
0
 
fosiul01Author Commented:
i am not in php for long time!!!

so it would be hard for me pick things up ..

have you look at this link

http://wordpress.org/extend/plugins/comment-reply-notification/installation/

any idea why thsi one is not sending email ???
0
 
fosiul01Author Commented:
or even is there any other plugin i can use to do my task ??
0
 
fosiul01Author Commented:
i found another plugin "mail to commenter"
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.