Author Archives: simonwheatley

Spot the duplicates, using a Gravatar identicon hack

A project at work needed me to write a UI to find and delete duplicate attachments on a single post, from a client’s WordPress website. Creating a couple of queries where I could look over each post in turn, and check a hash for each file attached, then spot the duplicate hashes wasn’t too hard. Where I was struggling was making the rows with the duplicates stand out visually, file hashes, e.g. bc38d8d8993b5e9f4617576d2adeb875, are just not that easy to distinguish from other hashes, e.g. dbe0256fe35b88ebd4e4e433604b7487… see the problem?

What I wanted was some way of mapping a file hash to a colour, or something strongly visual. Which is when it occurred to me; Gravatar could do this! Continue reading

Apple Mail sending email from the wrong account

I’m currently running Apple Mail with the unified inbox option, so I can connect to my old company email address as well as my Code for the People address and see everything in one place. There’s settings in Mail to allow you to set the default sending address, and when you reply to a mail it should pick the correct account. Trouble was, I kept noticing that my mail was going out under the new account when I was sure I’d specified the new account to be the sending address. Infuriating and embarrassing.

Continue reading

Protecting staging sites with Basic Authentication

This approach was primarily devised for use with WP Engine staging sites, but will work in any situation where you have no access to Apache’s config and need to use a single .htaccess file for multiple domains (e.g. a multisite setup).

We’ve recently had a couple of projects hosted on WPEngine where we need to have a staging site protected by Basic Authentication so only authorised users can access it. Normally I would configure Basic Authentication in the Apache VirtualHost, but on WP Engine (for example) they handle all the server configuration for us, meaning we don’t have access to the Apache configuration. WPEngine also provide a Git push to deploy facility, which we tend to take advantage of because Version Control Rools, OK? Because all the web files are within Git version control, we are using the same .htaccess file for the developer, staging and live sites. (We could Git ignore the .htacess file, but I prefer to version control more, rather than less.)

Continue reading

A plugin to clear recalcitrant caches from inside WP Engine

We’re using WP Engine to host various clients, notably the Rolling Stones site, and we’ve been very pleased with both the service and the performance of their hosting platform. There’s always something though, isn’t there? I don’t think I’d really be happy if there wasn’t. In this case it’s the fact the Varnish caching layer that sits between the site and the visitors caches “non-200″ responses for 24 hours. So what does all that mean? What’s the actual problem here? Continue reading

What happened at the WordPress Community Summit (presentation)

Here’s the presentation I gave to Manchester WordPress User Group last night on the first WordPress Community Summit in 2012. Here’s Jane Wells’ initial post explaining the thinking behind the summit.

If you want to learn more about what’s going on, you can see the summaries posted on the day for the morning and the afternoon, and watch the “notes” category archive as the session notes are going up now.

Setting HTTP Basic Authentication based on the host name

For many of our projects, the .htaccess file is under version control… but at the same time, I need to put HTTP Basic Authentiation on just the staging site. Unfortunately the host weren’t able to do this for me, but with a little .htaccess trickery I was able to detect the staging site URL and trigger the authentication.

Why do I want to do this? Well, pretty often the client is keen to see how some new, embargoed, content is going to fit together, whether that’s a group of new pages or a new masthead, etc. I don’t want just anyone guessing my staging site URL and wandering around getting information they shouldn’t! Continue reading

“Cooperate on a technical level and compete on a business level.”
Jeffrey McGuire, Acquia

Seen on a slide at PHPNW12, I like this summary of how companies interrelate in open source.