Skip to content

Blog

WordPress, Custom Field Suite and the WP REST API as a Middleware Platform

WordPress logo

Over the last five years or so, I’ve worked a lot with WordPress — developing custom plugins as well as piecing together pre-existing components to build (hopefully) really great websites.

But WordPress is more than just a blogging tool, and can be more just a tool for websites.

My most recent WordPress-related endeavour has been in my day job.

I have been looking at taking various bits of information about business processes that thus far have been disparate and disconnected and structuring and centralising that information so it can be more useful.

I’ve been using custom post types in WordPress for different types of information. Custom Field Suite makes describing the metadata we want to store a breeze, and effortlessly provides a beautiful and usable interface for “mere mortals” to input and manipulate the data later in the WP-Admin interface.

I work in an education environment; a simple example of one of these entities is the lunch menu (formerly just a Word document with no meaningful machine-readable structure at all). This was a nice, easy and public entity to start with.

So, we have a:

  • Custom post type for a lunch menu
  • A Custom Field Suite field group attached to the custom post type
  • Members plugin to control read and write access to that custom post type 

The final piece of the puzzle is using the WP REST API to be able to expose this data to other systems.

With a very small amount of code, the REST API can be convinced to enable access to these custom entities — and of course we still retain WordPress’ access control (with a little help from the Members plugin) to ensure we’re not too free with our data!

Now we have somewhere where non-technical users can go to input data and the ability then to export that data through the REST API into any other application. Because we’ve formalised the structure of the information, we have the flexibility to display it in all sorts of different ways that are appropriate for the medium.

So our lunch menu can be:

  • Exposed via the web
  • Displayed on a screen in public areas
  • And more!

The lunch menu design was an exciting proof of concept of the idea. I’m now moving on to slightly more ambitious projects which involve using a little bit of custom ‘glue’ in PowerShell (but whichever programming language is appropriate could be used!) to write data from other external systems into WordPress for later use.

Getting information out of big proprietary information systems using their provided tools that require… shall we say patience… has been a challenge. But, once liberated, this information is now stored, structure, and now can be queried simply and securely for all sorts of uses.

Back in 2011 when I started developing for WordPress with Chris from Van Patten Media, I remember thinking to myself, “yeah, I can probably figure this out”. It perhaps wouldn’t have been so obvious then that building a skill set with a ‘blogging tool’ would prove useful five years later in a quite different context, but this is testament to the versatility of the WordPress platform and what it has become!

Piwik for Web Analytics

Google Analytics is almost ubiquitous as the solution for collecting useful information about how your website is being used by visitors. It is a good product, and has evolved over the years to be very flexible indeed.

But since it first launched, my opinions of Google have certainly changed, as have many others. Without wishing to get into a debate on the subject, there definitely is a market for a competitor to this very useful tool that might free us of that reliance on Google infrastructure, and be more respecting of our visitors, by means of initatives like Do Not Track.

Piwik screenshot

Piwik’s desktop and mobile views

I recently deployed Piwik, an open source PHP-based application intended to replace Google Analytics. A full disclosure — it will not be as full-featured as Google Analytics for those people using the full power of that solution, but it puts the power and control back in your hands. Moreover, it uses a very similar-looking (perhaps even largely compatible) JavaScript API, meaning I had to do little work to figure out how to track the events that I wanted.

With built-in support for avoiding the use of cookies altogether, you can sidestep the well-meaning, but ridiculously ill-conceived EU Cookie law and its onerous “we use cookies!” notifications entirely, while still delivering enough tracking capability for many simpler analytics applications where detailed insights into repeat visits aren’t so important.

I haven’t made the time to replace Google Analytics on this site with it yet, but that is on my list of things to do! Right now, I have some custom code server-side that detects your Do Not Track status and suppresses the Google Analytics JavaScript entirely, but Piwik would do away with that need for complexity.

It might not do enough for your application — but as a way to put your money where your mouth is and genuinely support the user’s right to give and withdraw consent for tracking, it is most definitely worth a look.

Creating a Custom Child Theme in Moodle 2.6

I’m spending a fair amount of my time now working on and supporting a medium-sized Moodle installation. I will not sugar coat it: Moodle is far from my favourite piece of web software — its considerable UI complexity being my chief complaint — but it does do a reasonable job and it has a rich enough feature set to make it quite an asset in the education world.

This complexity to Moodle sometimes doesn’t exactly make it easy to do the right thing as a developer, and working with themes could be somewhere where developers diverge from best practices. The temptation to clone your favourite theme just to make a few tweaks here and there leaves people unable to track changes to the base theme, and keep their site up-to-date.

So, I have put together a video showing how you can create a custom theme (a child theme in WordPress parlance) that inherits mostly from your base theme, but allows you to override CSS and even bits of the HTML structure of Moodle’s generated pages.

I think it’s actually an easier process than people think!

As always, I welcome feedback, and if you found this particularly helpful, I’m always happy to have a few pennies drop into the PayPal account!

Find this tutorial useful?





On Vine and Third-Party Use of Your Content

Vine logo

None of the commentary with respect to terms of service and legal agreements in this blog post can be taken as legal advice. If in doubt, ask someone who really knows their stuff.

I really like the medium of short, tweetable videos that Vine has made popular. It succeeds where other video-over-Short-Form “Bird” Social Media Site Before It Went Terrible services, such as yfrog’s, failed. Once again, it is actually by imposing limitations that we find a unique way to express creativity.

So, I toyed with the idea of joining Vine, even despite it not supporting protected accounts like on Short-Form “Bird” Social Media Site Before It Went Terrible. But being an unusual breed, I felt it necessary to read and at least attempt to understand the Terms of Service.

I didn’t like what I saw. (All emphasis is mine.)

You retain your rights to any Content you submit, post or display on or through the Services. In order to make the Services available to you and other users, Vine needs a license from you. By submitting, posting or displaying Content on or through the Services, you grant us a worldwide, non-exclusive, royalty-free license (with the right to sublicense) to use, copy, reproduce, process, adapt, modify, publish, transmit, display and distribute such Content in any and all media or distribution methods (now known or later developed).

This is a standard kind of sentence you will see if you read many different ToSes. It is, apparently, the boilerplate for “we need your permission to display the stuff you are posting”. It seems fair enough.

You agree that this license includes the right for Vine to provide, promote, and improve the Services and to make Content submitted to or through the Services available to other companies, organizations or individuals who partner with Vine for the syndication, broadcast, distribution or publication of such Content on other media and services, subject to our terms and conditions for such Content use. Such additional uses by Vine, or other companies, organizations or individuals who partner with Vine, may be made with no compensation paid to you with respect to the Content that you submit, post, transmit or otherwise make available through the Services.

Suddenly, this paragraph changes the tone — from “we’re needing a licence to actually display your stuff at all” to “we’ll reserve the right to exploit any commercial value in your creativity whenever we feel like it”.

It is not just about using your content to further promote Vine, it seems to leave the door open for them to sell your content to anybody at all, subject to some additional terms and conditions I didn’t find.

I am not naïve. I know these services will need to make money eventually, and that a ‘free’ service comes with an exchange of value, even if it is not you paying a monthly fee.

With that said, this is not an acceptable arrangement for me, and I would encourage others to examine the value of the content they expect to submit to Vine in the light of these words.

Contrast Vine’s ToS with similar verbiage in the YouTube ToS:

When you upload or post Content to YouTube, you grant: to YouTube, a worldwide, non-exclusive, royalty-free, transferable licence (with right to sub-licence) to use, reproduce, distribute, prepare derivative works of, display, and perform that Content in connection with the provision of the Service and otherwise in connection with the provision of the Service and YouTube’s business, including without limitation for promoting and redistributing part or all of the Service (and derivative works thereof) in any media formats and through any media channels;

In short, YouTube might use your stuff to further YouTube as a platform, on any medium, but they aren’t going to reserve the right to flog it off to some ‘partner’ who may not be as fair about compensating you. (Also, YouTube’s existing, long-term relationships with their content partners demonstrates, in my view, a much better mutual respect than the implication of Vine’s ToS.)

There seems to be a weird irony that it is exactly the fact that Google wants to jealously keep you and your content in their ecosystem that they aren’t going to pawn it off to someone else’s ecosystem who might not treat you right.

I’m not saying don’t use Vine. That is your decision, based on what you find an acceptable deal. But don’t be in the dark about the potential implications of these differences in that agreement that, on the surface, might appear subtle, but could be really important.

Today, if you put your stuff on YouTube, and it gets popular, you can join the Partner Program and get compensated for the value in your content. With Vine, however, maybe there would never be an opportunity to see any value from your work. I think they need to answer that question, even if the implementation is not here yet.

Protecting the value of the content you create, whilst always being respectful to your customers, is not just for big media organisations. We are all creators, and we all deserve to have mutually respectful relationships with those who publish our content on our behalf, and those who consume it.

Former Bird-Site vs IM from my (Introverted) Perspective

UPDATE: references to the former Bird Site of short-form social media have been adjusted to avoid providing free publicity to something that is undeserving of such promotion. This is no longer how I feel about this website, but my historical feelings are to be preserved below, with the relevant site’s name obviously altered!

I want to discuss something that has been on my mind for quite some time. I haven’t really discussed this before, at all, on the internet or maybe even in real life.

The internet has allowed us to communicate in brand new ways using innovative new media. It seems that in a very short time, the number of ways that I can choose to communicate with someone has shot up exponentially.

One of these new-fangled ways of communicating is Bird Site (for the uninitiated, go read Wikipedia).

I find Short-Form “Bird” Social Media Site Before It Went Terrible to be a very useful social tool for communication, conversation and keeping up with people. In contrast, I find traditional instant messaging (IM, such as AIM, MSN, XMPP/Jabber and the like) burdensome and difficult to use on a consistent basis.

My dislike of the traditional IM most likely stems from my introverted personality. Hopefully in this post I will explain exactly why and why Short-Form “Bird” Social Media Site Before It Went Terrible is better.

Note that this is purely my opinion for what works for me. Everyone is different, which means that what might be true for me may not be for someone else, even with a similar personality. These are my personal views on Short-Form “Bird” Social Media Site Before It Went Terrible vs IM.

» Read the rest of this post…

SearchWiki, Gmail Themes and Keeping Things Simple

A couple of things have been bugging me recently. More specifically, two of Google’s new features they’ve added to their popular services haven’t sat very well with me.

Advance warning – this is a bit of a rant. I’m aware I’m being a little strong about two things which perhaps aren’t awfully important in the grand scheme of things. Anyway, here goes.

SearchWiki = Fail

The first is the Google SearchWiki thing. My friend Chris Van Patten shares my viewpoint on this and sums it up very well in this Short-Form “Bird” Social Media Site Before It Went Terrible update.

It’s google’s job to craft my search results, not mine.

In addition to that, though, I find the new wiki controls next to each search result visually distracting. I mean, yes, they’re subtle, but the whole point of the Google interface is that it is effortless to use and really really simple.

» Read the rest of this post…

Google Chrome

Google Chrome logo

There has been a considerable traffic spike here, since Google announced their new web browser, Google Chrome.

Not because I’ve spoken about it until now, but because it sparked interest in my thoughts on Gecko vs WebKit.

Google Chrome is considerably ‘buzz’-y at the moment, so I thought I would fire up an internet-connected Windows machine and give it a try.

My website in Google Chrome

While from a technical point of view much of the browser seems very interesting – and a very good idea (separating each tab into its own individual process, the new V8 JavaScript engine), at the moment I can’t see it offers much unique user-visible functionality.

Regardless of whether something is technically awesome or not, you won’t get the masses to use it unless they can see a killer feature – something that is visible to them and benefits them.

There are some unique elements to Chrome’s interface – specifically the single address/search bar (Omnibar), but I can’t help feeling underwhelmed at the lack of ‘killer-ness’ about the browser at the current time.

It is early days, though – and Chrome does show some promise.

About time!

Google Reader finally has a search box, but more importantly, actually tells you how many items are left to read if there are more than 100.

Previously, you’d just get the extremely descriptive 100+ which didn’t really give you a realistic estimate of how much reading there was to do.

GoogleReaderNew

It is about time!

Erm… MyOpenID…

bbPress – ugly (at the moment), but promising