• ResolvedPlugin Contributor Brandon Kraft

    (@kraftbj)


    Code Wrangler

    With pingbacks being sent to the site while also using Disqus, the plugin is seemingly causing spam pingbacks caught by Akismet to be sent out to the post author.

    Untested, but, what about something like this to eliminate that:

    function disqus_notify_content_author($comment_id, $comment = null) {
    	$comment_status = wp_get_comment_status( $comment_id );
    	if ( $comment_status != 'spam' ) {
    		wp_notify_postauthor($comment_id);
    	}
    }
    
    add_action('wp_insert_comment', 'disqus_notify_content_author', 11);

    Cheers!

    https://wordpress.org/plugins/disqus-notify-content-author/

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Janne Cederberg

    (@jcederberg)

    Hey Brandon!
    Thank you for your feedback/contribution!

    SHORT REPLY:
    Could you please edit the plugin in WordPress plugin interface and replace the code with this: https://plugins.trac.wordpress.org/browser/disqus-notify-content-author/tags/1.1/disqus-notify-content-author.php?format=txt and verify if it solves the problem? Thank you 🙂

    LONGER REPLY:
    I used the approach you described but as wp_insert_comment hook already gets passed the comment object, in order to avoid unnecessary lookups, I opted to get the comment_approved info from that object. The only thing I’m not sure of currently is whether the comment object that gets passed into the wp_insert_comment hook has been updated by prior hook functions or if the passed object is “at initial state”. Due to the fact that in PHP5 objects are passed by reference by default, I’m thinking the comment object should/probably holds the “active state” corresponding to the possible alterations made by prior wp_insert_comment hooks.

    Could you help me out by going in the WordPress plugins listing and editing the plugin by replacing the current code with the following v1.1.RC1 code: https://plugins.trac.wordpress.org/browser/disqus-notify-content-author/tags/1.1/disqus-notify-content-author.php?format=txt

    For debugging I added a function that writes a dump of comment data into your WordPress root in a file called comment_dump###.txt where ### is the id of the comment. Feel free to comment out the call to that function in case you don’t want it.

    Do these changes seem to fix the problem, in other words that Akismet-marked pingbacks do not end up notifying authors anymore? If yes, I’ll release the code (with debugging dump removed) as version 1.1.

    Thanks in advance!

    Plugin Contributor Brandon Kraft

    (@kraftbj)

    Code Wrangler

    That makes sense and I’m not fully sure the answer either. I activated the code and will let you know. It’s a group site, so I’ll let you know once I hear back if individuals are seeing notifications or not.

    Cheers!

    Plugin Contributor Brandon Kraft

    (@kraftbj)

    Code Wrangler

    The dump looks good, waiting for confirmation from the author on if they were notified or not:

    object(stdClass)#554 (15) {
      ["comment_ID"]=>
      string(5) "30895"
      ["comment_post_ID"]=>
      string(5) "23730"
      ["comment_author"]=>
      string(73) "[removed]"
      ["comment_author_email"]=>
      string(0) ""
      ["comment_author_url"]=>
      string(72) "[removed]"
      ["comment_author_IP"]=>
      string(15) "112.111.184.164"
      ["comment_date"]=>
      string(19) "2014-12-24 08:01:04"
      ["comment_date_gmt"]=>
      string(19) "2014-12-24 14:01:04"
      ["comment_content"]=>
      string(312) [spam removed]"
      ["comment_karma"]=>
      string(1) "0"
      ["comment_approved"]=>
      string(4) "spam"
      ["comment_agent"]=>
      string(65) "Mozilla/5.0 (Windows NT 6.1; rv:26.0) Gecko/20100101 Firefox/26.0"
      ["comment_type"]=>
      string(9) "trackback"
      ["comment_parent"]=>
      string(1) "0"
      ["user_id"]=>
      string(1) "0"
    }
    Plugin Author Janne Cederberg

    (@jcederberg)

    Ok, cool, thank you for the update!

    Plugin Author Janne Cederberg

    (@jcederberg)

    Hey Brandon!
    Anything new regarding this issue? Did you receive info from the author on whether they were notified by email or not? (in reference to your prior: “…waiting for confirmation from the author on if they were notified or not.”)

    Plugin Author Janne Cederberg

    (@jcederberg)

    Version 1.1 now includes this feature of not notifying author of comments that have spam status as true.

    Hope this helps 🙂

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Check spam status?’ is closed to new replies.