Monday, 3 January 2011


This morning I was trying to fix some problems with my hacked together filsofo comments / subscribe2 plugin for wordpress. I had received some bounced emails from the filsofo comments subscribe part of the plugin. The plugin creates a new user for anyone who subscribes to comments and whose comment isn't marked as spam.

The bounced emails appeared to be sent to email addresses entered by spam comments, so I thought it must just be that askimet hadn't marked them as spam until after the email had been sent. When I checked the database, the users didn't exist at all. And even more weirdly, the user IDs were less than the highest user ID in the database.

I checked that the bounced emails weren't originally sent before I had updated the plugin, and they weren't. I did a test comment myself, and my user was added to the database okay, and with the next correct sequential ID. So I have no idea how those emails could have been created or sent.

Next I had a problem with my website sending out a weekly digest email with just the 5 oldest posts from the blog. After some investigating, I found this was due to the way wordpress' get_posts function works. One of the parameters of the function is 'include', which is a list of posts you want to include. So I use this to specify which posts are to be included in the email.

But in the last week, I haven't made any new posts. So the include parameter was passed with either an empty string or null as it's variable. This meant that instead of not including any posts, get_posts included all posts. So to fix my function I just had to make sure that a list of posts to include did exist before calling get_posts.

And the thing about 5 posts is that get_posts only retrieves 5 posts by default. So I changed that to -1, which is unlimited.

The rest of the day I was working on my ebay wordpress plugin. In the evening I also watched an episode of Star Trek TOS with Mauser and Bo, did a Japanese lesson with Mauser, and watched Magi Rangers with Bo and Mauser.

No comments: