• I’m having a similar issue to jean01 in their post:

    http://wordpress.org/support/topic/270843?replies=2

    I have Akismet activated and working properly. Notify on Comment is sending email notifications about spam comments even though they have already been marked as spam and I have selected the option to send notification only if a comment needs moderation.

    I tried the fix that worked for jean01 but all it did was send an email with a blank body, but the same subject as before the fix.

    One step further than this issue: it would be great if Notify on Comment and Akismet could play nice enough together that I could turn off the send notification only if comment requires moderation option because comments from return commenters will not require moderation but would still be good to be notified about.

    Thank you for a great plugin and I hope these issues can be resolved!

    http://wordpress.org/extend/plugins/notify-on-comment/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hi ill.selettore,
    you and jean01 are right at the current time NotifyOnComment doesn’t know the askimet response for the comment but i don’t think that it’s too difficult to add this features. Looking to jean snippet i think that should work if you place the @wp_mail() inside the if() you don’t have to receive the mail not just a blank mail.

    I haven’t tested this but i think that it shuld works and it’ better than a check only for @wp_mail()

    <?php
    /*
    Plugin Name: Notify on comment
    Plugin URI: http://www.artbits.it
    Description: Send a notification on comment to the author of the post
    Version: 1.03
    Author: Fabio Trezzi
    Author URI: http://www.artbits.it
    */
    
    function notifyOnComment_send($commentID){
    	global $wpdb;
    	// Get the email of the post's author
    	$comment = get_comment($commentID);
    
    	// Do not send email for comments marked as Spam
    	$modereation_required = get_option('moderation_notify');
    	$approved = $comment->comment_approved ;
    	if(!$modereation_required || $approved == 1 || $approved == "spam"){
    		return true;
    	}
    
    	$post = get_post($comment->comment_post_ID);
    	$user = get_userdata($post->post_author);
    	$to = $user->user_email;
    	// Set the send from
    	$admin_email = get_option('admin_email');
    	$headers= "From:$admin_email\r\n";
    	$headers .= "Reply-To:$admin_email\r\n";
    	$headers .= "X-Mailer: PHP/".phpversion();
    
    	$comment_author_domain = @gethostbyaddr($comment->comment_author_IP);
    	$comments_waiting = $wpdb->get_var("SELECT count(comment_ID) FROM $wpdb->comments WHERE comment_approved = '0'");
    
    	$moderationOpt = get_option('notifyOnComments_moderationRequired');
    
    	if($moderationOpt == 'true'){
    		// Only send the notification if the comments requires to be moderated
    		$approved = $comment->comment_approved;
    		if($approved != 0) return;	// No need to send the mail the comment is already approved
    	}	
    
    	$template = get_option('notifyOnComments_emailTemplate');
    	// If not setted load the default from file
    	if($template || $template == "") $template = file_get_contents(dirname(__FILE__) . '/defaultTemplate.php');
    
    	// Replace all the constant with the rights values
    	$template = str_replace("{postID}", $post->ID, $template);
    	$template = str_replace("{postTitle}", $post->post_title, $template);
    	$template = str_replace("{author}", $comment->comment_author, $template);
    	$template = str_replace("{authorIp}", $comment->comment_author_IP, $template);
    	$template = str_replace("{authorDomain}", $comment_author_domain, $template);
    	$template = str_replace("{authorEmail}", $comment->comment_author_email, $template);
    	$template = str_replace("{authorUrl}", $comment->comment_author_url, $template);
    	$template = str_replace("{commentContent}", $comment->comment_content, $template);
    	$template = str_replace("{commentLink}", get_permalink($comment->comment_post_ID), $template);
    	$template = str_replace("{commentID}", $commentID, $template);
    	$template = str_replace("{commentsWaiting}", $comments_waiting, $template);
    	$template = str_replace("{siteUrl}", get_option('siteurl'), $template);
    
    	$subject = sprintf( __('[%1$s] Please moderate: "%2$s"'), get_option('blogname'), $post->post_title );
    
    	@wp_mail($to, $subject, $template, $headers);
    
    	return true;
    
    }
    
    function notifyOnComment_menu() {
    	$path = dirname(__FILE__);
    	$pathElements = explode('/', $path);
    	add_options_page('NotifyOnComments options', 'NotifyOnComments', 'manage_options', $pathElements[count($pathElements) - 1] . '/options.php');
    }
    
    add_action('comment_post', 'notifyOnComment_send');
    add_action('admin_menu', 'notifyOnComment_menu');
    
    ?>

    It actually works exactly as I would like; isn’t this how it should. You want people w/o admin rights, contributers, to be notified when their posts get comments.

    Only glitch was you have to mod. the default php to config email; won’t work in Dashboard.

    great work!!!!!!!!!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Plugin: Notify on comment] No Moderation Required But Email Still Sent’ is closed to new replies.