Today’s Hack: Fixing broken email in a comment subscription plugin.

It seems like everyday I am trying to fix something. Somehow, something that was working perfectly fine is now broken and I have to fix it. Sometimes I had mistakenly assumed that something was working a certain way, when it wasn’t, so I have to fix that. Today, I have a bit of both to share with you, concerning this website.

One of the key ingredients to growing a blog is community. Typically, for blogs, that is built though user interaction via comments. To keep the conversation going, you really need to allow people to choose to be notified as the conversation progresses. You could set up a feedburner.com comment feed for every post, but that just seems silly to me. The easiest way is to use a plugin that enables people to subscribe to comments.

That leads me to the “assumption” part of today’s post. For some reason, I assumed that Standard Theme had this functionality built-in. It seemed like the little checkbox for subscribing to comments was on every Standard theme site that I visited. As it turns out, it is NOT included, after all. So after some research I discovered that Michael Hyatt and others were using the Subscribe To Comments plugin by markjaquith. I found it, and installed it, but it did not work.

It looked like it did, but in fact, no emails were being sent. That brings me to the “broken” part of today’s post. I am not sure why, but some of the email functions on this server work great, some don’t. I have researched the issue and it seems from support forum posters that there may be an issue with the way our domain name provider handles headers (not absolutely convinced that this it the problem, but…). The result is that I typically have to modify plugins that send email. Looked like I was going to have to do the same here.

I share this since you too may have had issues with plugins that email. Maybe you can adapt this method. Here’s how I fixed it:

1. Click on the “Editor” link in your sidebar under “Plugins”

2. Select the plugin to edit from the dropdown box.

3. Click on the “subscribe-to-comments/subscribe-to-comments.php” link to edit that file (it may already be chosen).

4. Find the following line of code:
[php]return wp_mail($to, $subject, $message, $headers);[/php]

5. Change it to:
[php]return wp_mail($to, $subject, $message);[/php]

6. Test it by logging out of WordPress, and posting a comment using an email that is different than the one associated with your blog. If you get the email, then this solution works. If not, you have a different problem.

Leave a Reply

Your email address will not be published. Required fields are marked *