SEATT Feature Wishlist

Since I’ve updated SEATT there’s been requests for functionality. The ones I’ve captured are below, in a rough priority order:

  1. Repeatable/recurring events – Some sort of functionality to allow repeatable events – whether this be decoupling of event details from dates, or some other mechanism.
  2. Event calendar shortcode and layout – Allow you to group events into categories and display all relevant events in a list view on a post.
  3. Custom page layout to help display events for #2.
  4. Allow admin to use tinymce content editor.
  5. Register for events without requiring an account – I’m currently planning to do this via email confirmation and with a captcha, but need to test it.
  6. Email notification – More broad email notification, both upon registration (to user and admin), and also allowing admin to email users.
  7. Custom list pages and fields – Allow admins to change what information the plugin lists, and where it draws usernames and names from.
  8. Allow other users to see comments on short-code form.
  9. Additional columns in database to capture event details.
  10. Internationalisation, and custom locale options – This includes the option to allow the user to call an “Event” a “Ride” or similar.

Thanks again to all of you for getting in touch, and to those of you who have provided snippets based on your modifications to the plugin. I’m hoping to get through at least a couple of these in the coming months.

SEATT updated to 1.3.0

I’ve updated Simple Event Attendance (SEATT WordPress plugin) to version 1.3.0. This brings bug fixes, and updates in line with the release of WordPress 4.3.1.

Firstly, an apology for taking so long to release another version – feel welcome to get in touch if you want to discuss changes you’ve made to your code in the interim. These are largely security changes, so it’s recommended that you update when you can. The database structure hasn’t changed, so you should experience no loss of data.


  • Ensured the database elements all use the correct version of wpdb->prepare where needed, and tidied up any inconsistent usage where statements weren’t prepared. Thanks to J.D. Grimes for chasing me on this.
  • Made some text and layout changes throughout to work better with the WordPress default templates.

In the pipeline are a few more changes that should further improve functionality of the plugin:

  • Some sort of functionality to allow repeatable events – whether this be decoupling of event details from dates, or some other mechanism.
  • Selectable categories for lists, allowing you to put one shortcode into a post/page and get a list of all active events.
  • Anonymous registration – something that quite a few have asked for. It will be turned off by default but it is coming with captcha user verification.
  • Email notification – I haven’t explored this yet, but am hoping it can be done using internal wordpress functions.

Live at

As always, any feedback is very welcome.

Google Maps Distance (DistanceMatrix) API for UK in JSON

The postcode code has been updated to use Google’s distancematrix api, which provides a very different set of data from the old “as the bird flies” calculation (it calculates road distance, and provides transport options etc).

The following code is merely a demonstration, which can be seen here.

// Specify Postcodes to Geocode
$postcode1 = 'BH151DA';
$postcode2 = 'BH213AP';

// Set and retrieve the query URL
$request = "" . $postcode1 . "&destinations=" . $postcode2 . "&mode=driving&language=en-GB&sensor=false&units=imperial";
$distdata = file_get_contents($request);

// Put the data into an array for easy access
$distances = json_decode($distdata, true);

// Do some error checking, first for if the response is ok
$status = $distances["status"];
$row_status = $distances["rows"][0]["elements"][0]["status"];

if ($status == "OK" && $row_status == "OK") {

// Calculate the distance in miles
$distance = $distances["rows"][0]["elements"][0]["distance"]["value"];
$distance_miles = round($distance * 0.621371192/1000, 2);

echo 'The distance between '.$postcode1.' and '.$postcode2.' is '.($distance/1000).'Km ('.$distance_miles.' miles).';

} else {
    echo "Calculating the distance between your locations caused an error.";


Having better error checking would also be a good idea if you plan to use the above code. Using &unit=imperial is optional, as Google always returns metres – so the code runs a basic calculation on these to convert to miles.

Raspberry Pi Shutdown Switch – Safely Turning off the Pi

We use a model B rev 2.0 Raspberry Pi as one of our Samba and DLNA media servers, and normally turn it off through a Webmin control panel to ensure nothing untoward happens with any of the attached hard drives. This solution is less than ideal however, as it requires a second powered-on device and a couple of clicks to get to the shutdown page in the control panel.

The Raspberry Pi forum has am excellent thread about a simple & safe shutdown button, from which I copied to produce my shutdown switch. It’s something you can put together in less than 20 minutes if you have the parts.

All you need is to install the RPi.GPIO Python class on the Pi (use SSH to grab it, “wget”; unzip it; and install it, “sudo python install”; then remove the files to tidy it all up), and you can start accessing the pins via Python scripts.

Just connect pin 1 to a momentary open switch, and the switch to a 1K and a 10K resistor. Then connect the 10K resistor to the ground on pin 9 and the 1K to pin 11 (GPIO17). If you’re wondering where these are then this page has some nice illustrations; and more info on these pins can be found here. It’s worth covering the 5V line with some insulation just to minimise the risk of shorting out your Pi with it (see images below), as everything else on the GPIO header is 3.3V.

Breadboard setup, minus switch which would cross lanes 12 & 13.
Breadboard setup, minus switch which would cross lanes 12 & 13.
Raspberry Pi Shutdown Switch
In the case, soldered directly onto the pins with a momentary switch screwed into the case above the pi logo (hence minimising risk of contact)

All that’s left is to monitor pin 11 (GPIO17) for activity, for which I used the code on the Raspberry Pi forum.

Placed in /home/pi/bin/button/

import RPi.GPIO as GPIO
import time
import os
GPIO.setup(17, GPIO.IN)
while True:
os.system("sudo shutdown -h now")

Placed in /etc/rc.local on the line before “exit 0”

python /home/pi/bin/button/

Then the Pi will shutdown when the button is pressed for about 1 second – only the Power light will remain on (red) when it’s shut down. It’s worth noting that this won’t work if the Pi has crashed but that’s not an issue we often see.

Updated 22/01/15 – Thanks to “Joost” for clarification on pins, specifically that GPIO17 is pin 11 on the board.

SEATT Updated to 1.2.7

I’ve updated Simple Event Attendance (SEATT WordPress plugin) to version 1.2.7. This brings bug fixes, and updates in line with the release of WordPress 3.5.

  • Fixed problems with apostrophes being escaped with numerous backspaces in admin panel and in the comment box
  • Removed first+last name from page template as this is rarely used, with list users no longer in a table format, but now in an ordered list
  • Admins can now sign up registered users simply by supplying a username in the admin panel
  • Fixed problems with wp_prepare() causing errors in wordpress 3.5
  • Deleting the plugin now removes all database tables as well as files to provide clean removal. This means uninstalling will now remove all events


Live at