Menu

Snippets

Yet another programmer blogging about code

Archive for the ‘How-to’ Category

Payment receipts with Gravity Forms and eWAY

Tuesday, November 14th, 2017

Gravity Forms email notifications can be used to send simple payment receipts for eWAY transactions. (more…)

exim4 with wildcard email aliases

Saturday, December 31st, 2016

When you configure exim4 as your email transport, you will likely need to tell it to replace some user names with aliases. To make your life simpler, use wildcards to do the job for you. (more…)

Use Autoptimize effectively

Thursday, November 6th, 2014

Keeping your WordPress website fast can become pretty tricky once you start installing plugins and off-the-shelf themes. Everything seems to want to load at least one CSS stylesheet, and sometimes a dozen or more JavaScript script files. Some also inject great chunks of CSS and JavaScript into every page. Luckily, there’s the handy Autoptimize plugin to help you sort all of that out. (more…)

Tracking WordPress plugin compatibility with Trello

Wednesday, July 2nd, 2014

For a while now, I’ve been using the amazing Trello to help me keep track of various tasks. Sure, I use various bug trackers like Mantis and GitHub Issues too, but for some of the more high-level tasks it’s just easier with Trello. One job it’s particularly good at is helping me keep track of plugin compatibility testing. (more…)

PDF to OCR in Linux

Wednesday, March 19th, 2014

SWMBO has a pile of PDF documents to process and extract information from, and over 50 of them are scanned which means — NO COPY/PASTE! Unless we rescan with OCR of course. On Windows, she’d probably just use Acrobat, but on Linux… (more…)

eAccelerator and PHP closures don’t mix

Wednesday, October 9th, 2013

I struck an odd problem recently with some code using closures. I use closures extensively for WordPress filter and action hooks when building custom plugins and themes for websites, and all usually works well on any version of PHP from 5.3 up. But I was finding that my closures weren’t being called on some PHP 5.4 websites. The problem was eAccelerator. (more…)

Overview of building custom fields for Gravity Forms

Monday, January 14th, 2013

Gravity Forms is a great way to build all sorts of forms in WordPress. It can be so simple that non-programmers can easily build their own basic forms. It’s also incredibly flexible so programmers can extend it in myriad ways, even by adding some complex custom fields of their own. But as usual, there’s a trade-off — ease of use for non-programmers means lots of hoops to jump for programmers. Here’s an overview of how I built some fairly complex compound fields for a custom application using Gravity Forms. (more…)

Creating a custom gallery template for NextGEN Gallery

Friday, January 4th, 2013

NextGEN Gallery is one of the easiest to use image gallery plugins for WordPress, so we now try to use it wherever a website needs to have user-managed sets of images: sliders/carousels, trade/media galleries, scenic galleries, you name it. We can do that easily because NextGEN allows you to create custom gallery templates. (more…)

Stop turning off CURLOPT_SSL_VERIFYPEER and fix your PHP config

Wednesday, October 24th, 2012

As Pádraic Brady points out in a recent article about PHP security, there’s a whole lot of misinformation about how to deal with the error “SSL certificate problem, verify that the CA cert is OK” from curl. Nearly everyone advises that you turn CURLOPT_SSL_VERIFYPEER off (in fact, countless comments on the PHP manual page for curl_setopt tell you this). This is bad, because it allows your nice, encrypted stream of confidential data to be silently highjacked by a bad guy. Don’t do that! Instead, just fix your PHP installation so that it doesn’t get that error. (more…)

Different thumbnail sizes for NextGEN Galleries

Thursday, August 16th, 2012

Ok, so we’re allowed to have one (1) size option for thumbnails in all galleries, and they can be either cropped square, or not. This is my only option?

But what if I want to have a gallery page of all of the lovely staff for my clients website, and their photos have been sensibly taken in portrait format, I do NOT want the thumbnails for this gallery to be cropped, that would be just wrong. And then there is to be a page with a photo gallery of the staff picnic where people have enjoyed taking happy snaps in both landscape AND portrait formats because that is what suits, so I need these thumbnails cropped. (more…)