Category Archives: General

Jetpack Feedback Spam

Like many people, I use the Jetpack plugin to have a contact form on one of my sites. It’s  a nice thing to have there, even though nobody ever uses it. Well, at least I thought nobody was using it – I just ran a backup of the database and though it was taking rather longer than I expected. It turns out that I have actually been getting rather a lot of feedback, but all of it spam: tens of thousands of spam messages.

Now, the fact that the spam filters hid me from this is great – that’s exactly what they’re there for. But now they’ve built up and are taking up a large chunk of space in my database, I want rid of them. So, I set to. It turns out that’s not so straightforward.

Apparently, you can’t simply delete all your spam messages, you have to go through them a page at a time and move them into your trash. Once they’re in the trash, you can just click on the ‘Empty Trash’ button. Getting them into the trash however, was proving a little tedious.

The default number of items per page is 20. Trashing 20 at a time was going to prove slow progress. So, I upped the number per page to 500, still a lot of pages to get through, but should be faster. No such luck. Deleting 500 at a time results in a “URL too long error”. Good grief, have these people never heard of POST?

So, 100 items per page. Yes, that works, but boy is it tedious. After three pages I gave up. Can’t I just delete them from the database?

Yes, they’re all in the wp_posts table, and easy to identify. Except there’s a catch. They also have corresponding entries in the wp_postmeta table. That’s a bit more complicated to deal with. But then I realised, if I can just change them from ‘spam’ to ‘trash’ then I can get rid of them in one fell swoop with the ‘Empty Trash’ button. That will also then clean up all those loose ends in the wp_postmeta table.

So, one simple SQL statement is all I needed:

update wp_posts set post_status = 'trash' where
  post_status = 'spam' and post_type = 'feedback'

That finds all feedback items marked as spam, and moves them into the trash. Then, back over to the Feedback admin page and click on ‘Empty Trash’ and it’s all gone.

It really should have been easier than that though.

[Important: if you try this for yourself, do take a backup of your database first. Things always go wrong when you’re least prepared for them.]

 

 

 

Nothing But Onions

Some years ago, in an earlier incarnation of dopiaza.org, I ran a sub-blog as part of the web site, called Nothing But Onions, which featured bits and pieces about food and cooking. In the end, during one site reorganisation, I got rid of it as it didn’t really seem to fit well with the rest of the site which is primarily a vehicle to host various bits of software I’ve written.

More recently, I’ve had the urge to write a few food-related articles once more, but I realised that I didn’t have anywhere sensible to put them. So, last week I started up a new blog dedicated to my ongoing experiments in the kitchen. So, let me introduce to you, the one and only all-new Nothing But Onions. There are already a few posts up there, mainly dealing with a couple of recipes that a number of people have been asking for – finally I have somewhere to point them at! More good stuff will be coming soon.

This blog here at dopiaza.org will, of course remain, and I’m sure I will continue to forget to post to it for many years to come.

Site Update

I’ve moved the site over to a new server, hopefully I managed to bring everything along intact. If anything appears to be broken, do let me know in the comments below.

As part of the move, I’ve upgraded my version of WordPress, and switched to the standard twentyeleven theme for now, just to keep life simple. I’ve been fairly lax in my posting habits again just lately, but there’s been an awful lot going on – I’ll post a general roundup later.

New Look, Tidy Up and a Gratuitous Photo

I’ve been having a bit of a clear out. I’ve removed an assortment of old stuff from the web site that few people ever looked at. If you find your favourite Greasemonkey scripts now missing, then I’m sorry. I don’t really use Firefox any more and so am not actively maintaining those scripts. If you’re desparate, you can still find some of them over on userscripts.org, but as I said, they’re no longer being actively maintained.

We also have a nice new look to go with the clean sweep. I’ve de-cluttered and got rid of the sidebars, and added my latest flickr photos to the top of the page to brighten things up a little.  There’s still some tinkering to do, but it’s starting to settle down now.

And finally, a gratuitous photo:

Interval