How to Make Disqus Notify the Post Author When a New Comment Is Posted?

This is an interesting one. A new client is using the Disqus service to replace the default WordPress commenting system within their website. They noticed that post authors weren’t receiving notification emails when a new comment was added to their post.

After a bit of searching, I found the following blog post which confirms the issue and provides a simple workaround for it. Normally I’d never alter the code within a plugin (as it makes future updates a nightmare) but in this case, the pros outweigh the cons.

Update: 30 July 2014

As jeremyclarke pointed out, these days, rather than editing the Disqus plugin itself (which is a cardinal sin and should never be done) I would simply create a snippet, that hooks into the wp_insert_comment action or similar, and add it into my functions.php file or a custom plugin. Something along the lines of…

add_action( 'wp_insert_comment', 'disqus_notify_postauthor', 99, 2);

function disqus_notify_postauthor( $comment_id, $comment_object ) {
	wp_notify_postauthor( $comment_id );