Website technical details

To do list

  • Update Ninja Forms to v3
  • Install SSL cert on Youth Scheme
  • Retire redundant forms, remove associated code from rpnyc_ninjaforms.php
  • Remove redundant pages and posts
  • Publish historic posts (ie: ex-Joomla) which are of historic value


We run a WordPress network. The network runs the most recent stable release of WP. Updates to new versions are automatic.

Some plugins are network enabled (ie: all site can use them) others are enabled on individual sites only. The Ninja Forms plugin is licenced for one site only (club), and is only visible there. There is a performance cost to enabling unnecessary plugins.

The network sites are:

  • Site 0 – RPNYC/club
  • Site 1 – Regatta
  • Site 2 – Youth Scheme
  • Site 3 – WOS

All sites run their own themes, all of which are child themes of Smart-Mag.


There are two databases: one for the legacy Joomla site, and one for the production WordPress network.

WordPress table names are prefixed with ‘kezjez’. This is simply a random string to make it hard for people to hack the site without already knowing the prefix. Some queries in the rpnyc-helper plugin will be hard-coded to use this prefix, others will get the prefix parameter from WordPress. Any future queries should NOT hardcode the prefix, to make a change easier in future if necessary.

The club site uses ‘kezjez’, while the remaining site used ‘kezjez_1’ etc. Some tables are shared between sites.

Non-Wordpress table names are prefixed with RPNYC. These tables hold race results (etc).

There are also a number of views which support wpDataTable queries.


The main club site has a 1 year ‘PremiumSSL’ certificate from Umbrellar (issued by Comodo), costing $40. This was necessary for the credit plugin used with Woocommerce. A similar certificate will be need to accept payments on other sites. WOS wont need such a cert as its payments will be taken via Booking Boss.

Android has given us some problems… iOS and desktops happily download intermediate certs from the CA, while some versions of Android (especially older ones) expect the certs to be delivered by the web server if required. This means that we need to install the intermediate certs as well as the root/CA cert. See here for instructions.

See here for diagnostic info about our TLS/SSL status.

RPNYC plugin

The rpnyc-helper plugin contains php which modifies the behavior of the club site (only).

The key files are:

  • rpnyc.php: This is the main plugin file, the one recognised by WordPress. Calls the other files below.
  • rpnyc_email.php: Ensures that emails come from address, and that the sender appears as “Royal Port Nicholson Yacht Club”.
  • rpnyc_errorlog.php: Function to log to a custom log file.
  • rpnyc_functions.php: Contains a range of minor functions, mainly data functions which feed rpnyc_datatables.php or other functions.
  • rpnyc_login.php: Tweaks look and feel of login page.
  • rpnyc_ninjaforms.php: Writes the content of certain forms to custom tables. Also fetches data before some forms are rendered, to pre-fill dropdowns (etc).
  • rpnyc_results.php: Downloads results from Blue Peter, calculates series results, and saves to DB. Call by Cron.
  • rpnyc_woocommerce.php: Tweaks the behaviour of Woocommerce. Sends custom email. Currently only sends the daily Braintree reconciliation
  • rpnyc_wpdatatables.php: Called by WPDataTables, returns base64 encoded serialised array of data. Calls rpnyc_functions.php which actually prepares the data. This file is called directly by WPDT, and is not included by rpnyc.php.

Other code appears in the functions.php file in each theme, and in page templates.

The results tables (etc) are rendered by post-22428.php.

Key plugins

  • Events Calendar Pro (paid version)
  • Woocommerce (free, with paid add-ons)
  • Ninja forms (free with paid add-ons)
  • wpDataTables (paid version)
  • Updraft (paid version)
  • Broadcast (paid version)

The Events Calendar Pro

Events Calendar Pro runs the calendar system. It is extended by Event Tickets, which connects calendar entries with Woocommerce.


Woocommerce uses a further plugin (WooCommerce PayPal Powered by Braintree Gateway) to take credit card payments. This plugin can also accept Paypal payments, but this is not currently enabled.

Ninja Forms

The site still uses v2.9. The version numbers will show 3 (or higher) but the forms are essentially in a sort of legacy mode. Upgrading to v3 forms will unlock some new functionality, but will also require extensive testing and tweaking. I started this but it became too hard, so I rolled back to v2.9. As v2.9 documentation is now much harder to find, the upgrade should be done at some point.


wpDataTables is probably the most effective, complete and powerful plugin we use. While it can access and display data in many ways, we use SQL (for simpler queries) and serialised arrays (for more complex queries). Serialised arrays are called through rpnyc_wpdatatables.php with a parameter to identify the data required. The rpnyc_wpdatatables.php file then calls rpnyc_functions.php which creates the array and passes it back to rpnyc_wpdatatables.php, which in turn passes it back to wpDataTables.

I sometimes encountered offset errors with serialised array data, and had to edit the plugin to overcome this. Rather than passing a raw serialised array to wpDataTables, rpnyc_wpdatatables.php first encodes the data the php base64_encode() function.

My edit to wpDataTables then decodes the data using base64_decode().

The edit is on line 1598 of “plugins/wpdatatables/source/class.wpdatatable.php”. The original code is on line 1599. Upgrading wpDataTables will destroy this edit. If you upgrade, re-do the edit immediately, as trying to edit a table without the edit being made will probably overwrite all of the settings for the table, and force you to rebuild it.


Backup system. Saves DB nightly. and the whole site weekly.

Saves backup files to Pedro’s personal Dropbox account.


Broadcast (free), and the Broadcast Premium Pack (USD $297) are a set of tools which help manage the multisite environment. The key tool is the one which allows us to ‘broadcast’ a post from one site to another. There are dozens of other tools.

Other plugins

Theme plugins

The following plugins came with the Smart-Mag theme are are required for the site to work:

  • Revolution slider
  • Bunyad Page Builder
  • Bunyad Shortcodes
  • Bunyad Widgets

An earlier version of custom sidebars pro also came with the theme, but has now been replaced with a current version.

Content plugins

  • Manual Image Crop (allows images to be manually cropped instead of cropped from the centre, as WP normally does).
  • Post type switcher (does what is says on the tin, incompatible with Broadcast… when needed, turn it on, use it, and turn it off again)
  • Simple CSS (allows CSS on a page-by-page basis, useful for one-off tweaks)
  • PHP code widget (creates a widget from PHP, eg: the NTC and postponement flags)

User/access management

The following plugins help with user/access management

  • Nav menu roles (limits menu items to certain user roles)
  • User role editor
  • BAW Login/Logout menu (tweaks the login menu/page)

Network/site management

  • Better search/repalce (allows search and replace DB wide, very rarely used)
  • Defender