WordPress.org

Ready to get started?Download WordPress

Forums

Safe Report Comments
Notify the moderator (11 posts)

  1. Bev
    Member
    Posted 1 year ago #

    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/

  2. Daniel Bachhuber
    Hand Built
    Plugin Author

    Posted 1 year ago #

    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' );

  3. Bev
    Member
    Posted 1 year ago #

    Absolutely that is a good way for now.

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

    Thanks!

  4. gormley
    Member
    Posted 1 year ago #

    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.

  5. Daniel Bachhuber
    Hand Built
    Plugin Author

    Posted 1 year ago #

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

  6. gormley
    Member
    Posted 1 year ago #

    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' );

  7. gormley
    Member
    Posted 1 year ago #

    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!

  8. Daniel Bachhuber
    Hand Built
    Plugin Author

    Posted 1 year ago #

    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.

  9. gormley
    Member
    Posted 1 year ago #

    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.

  10. gormley
    Member
    Posted 1 year ago #

    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.

  11. gormley
    Member
    Posted 1 year ago #

    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?

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.