Support » Plugin: Safe Report Comments » Notify the moderator

  • If you want to notify the moderator with an email when a post passes the threshold and is put on hold, just make this change to safe-report-comments.php:

    if ( $current_reports >= $threshold ) {
    	do_action( 'safe_report_comments_mark_flagged', $comment_id );
    	wp_set_comment_status( $comment_id, 'hold' );
    	wp_notify_moderator($comment_id); // <---- ADD THIS LINE
    }

    http://wordpress.org/extend/plugins/safe-report-comments/

Viewing 10 replies - 1 through 10 (of 10 total)
  • Plugin Contributor Daniel Bachhuber

    (@danielbachhuber)

    Neat trick 🙂 Rather than modify the plugin file, which will be changed on update, it would be better to add an action in your theme’s functions.php:

    add_action( 'safe_report_comments_mark_flagged', 'wp_notify_moderator' );

    Thread Starter Bev

    (@bstofko)

    Absolutely that is a good way for now.

    I thought it might be a useful feature to add to the plugin.

    Thanks!

    gormley

    (@gormley)

    hi daniel,

    your code didn’t seem to do anything. are we supposed to combine the two above codes in the functions file or should yours work directly?

    thanks.

    Plugin Contributor Daniel Bachhuber

    (@danielbachhuber)

    @gormley Mine should work directly. Do you have comment notifications disabled? Are other emails being sent?

    gormley

    (@gormley)

    notifications are not disabled.
    should this be going to the email address identified in the WP general settings?

    so to verify only the following needs to be inserted into my function file:

    add_action( 'safe_report_comments_mark_flagged', 'wp_notify_moderator' );

    gormley

    (@gormley)

    with some extra research i realized my new host + a WP upgrade was causing some email issues, but now my question to you is how do you receive an email that specifies someone has “reported” a comment. the current email i get looks exactly like a “moderate” email…

    “A new comment on the post “Post Title” is waiting for your approval”

    this will get confusing as there should be some way to differentiate a comment that has been “reporter.”

    thanks!

    Plugin Contributor Daniel Bachhuber

    (@danielbachhuber)

    You can do something like this instead:

    add_action( 'safe_report_comments_mark_flagged', 'sfx_flagged_email' );
    function sfx_flagged_email( $comment_id ) {
        wp_mail( 'youremail@domain.com', 'A comment has been flagged', 'Check it out in the admin' );
    }

    The email isn’t very descriptive, but you could easily make it more so.

    gormley

    (@gormley)

    unfortunately, nothing happens when someone reports a comment now. i even installed WP-Mail-SMTP to reconfigure the wp_mail() function to use SMTP instead of mail()

    i get email for new comments but nothing for reporting. checked spam & junk folder, but nothing.

    gormley

    (@gormley)

    the code you listed above has been added to the functions yet no email is ever received. all other emails works and have been confirmed.

    gormley

    (@gormley)

    I spoke too soon. it seems to work now.

    Now I am just trying to figure out how to list the specific post the comment is associated with within the email along with the comment.

    for instance:

    ____

    Subject: A Comment has been flagged

    The post “The Big Story” has had a comment flagged as possibly inappropriate.

    Comment: “please flag this comment. it is inappropriate… etc.. etc..”

    ______

    is this possible?

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Notify the moderator’ is closed to new replies.