From my diary

The last day was mostly lost in trying to sort out two problems with the blog software.  First, when posting a link to a post to Twitter, no image appeared.  Secondly, if I added a comment to a post, I – the author – got no email notification.

Yesterday I got fed up and delved into the WordPress code.  It’s PHP, after all, which is a language that I have used before.  A bit of debugging using PHP error_log() calls revealed that… if an author comments on his own post, by default WordPress doesn’t notify him.  Which is why I never saw any notifications.  Nor does WordPress make this a setting in the dashboard.  The change makes debugging a new installation that little bit harder.  The answer is to comment from another browser – one you are not logged into.  But of course nobody would  know that by default.

Anyway the code makes clear what the answer is: to write a little single-file plugin that overrides a WordPress function and returns “true”.  This I have done, and it works just fine.  Here it is:

If you activate the plugin, it overrides the bit of code (in wp-includes/pluggable.php) that checks whether author comments should trigger a notification email.  If you deactivate it, it removes that.

I’d always wondered about how to write my own plugin.  Fortunately it’s simple.

Now to see whether the Twitter stuff works or not.

Leave a Reply

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