Hacking, Software

Weird problems: wordpress truncating captions

I woke up this morning to a fresh new problem at work: Wordpres was truncating image captions. Specifically, we have a lot of old content (dating back to 2007!) and therefore old shortcodes, and the old style caption codes (which use caption as an attribute) were getting truncated. They were also showing their opening quote. It was ugly, and it was confusing because I hadn’t touched the server at all in about a week.

I initially suspected an errant plugin, because that’s the cause of 90% of my pain in WordPress. Last night I’d spun up a staging server from a backup, so I had a <24 hour old copy of the server. Our databases are on a separate machine so I refreshed the dev database too.

Irritatingly, everything worked fine on dev. To figure out what was different between the two servers I use rsync (from within the web directory on the dev box)

rsync -avun -e ssh kellbot@production:/path/to/public_html/ .

The -n flag is key because it does a dry run rather than actually copying the files

Among other things, wp-includes/version.php was different. Turns out a security update had been applied automatically (taking us from 3.9.2 to 3.9.3). I updated us to 4.0.1 (uh, yeah been meaning to do that …) and everything was fixed.

 

Hacking

Customizing Buddypress / bbPress notification emails

We’re spinning up another buddypress community at work and need to customize many of the outgoing emails. This can be done via filters but is kind of tedious and doesn’t make it easy for non-devs to update the messages later. I found a plugin called Welcome Pack which provides a fairly straightforward interface for customizing some of the Budddypress emails, and have started extending it to encompass all of the outgoing mail we need control over (bbpress, wp core emails).

screenshot-local.wordpress.dev 2014-11-11 16-12-55

Ideally I’d like to add an Admin interface to link up new filter hooks, but for now I’ve just got a filter function you can use in your theme or plugin. It’s very much a work in progress, right now I’m doing a lot of refactoring to make things a little better suited to our use case. I think by the time it’s done it will save us a significant amount of time that I used to spend hunting down and editing email templates.

You can view my fork of the project on github. If this is a project anyone else is interested in, let me know!