An afternoon of poking around the TRU Collector WordPress Theme has taken away an unnecessary vestige of how they started.
This goes back more than six years ago, yes to October 31, 2014 (guess who was not out trick or treating). How can my memory be that good? It’s not, but I have a detailed record of all the work I did on my TRU Open Learning Scholar Fellowship because I was foolish enough to blog it all.
The very first SPLOT was an experiment in creating one of those image comparison tools (like the more modern JuxtaposeJs or the H5P Juxtapose Image tool) It emerged as a WordPress theme named The Comparator (and is semi-broken as of now).
The need here was to be able to upload before and after images. Using the comparison jQuery library required the images be the exact same dimensions. Making this a requirement for a person using what should be a Simple tool seemed much. But it dawned on me that if images were uploaded to the WordPress media library like when one authors, WordPress does the work of creating multiple versions of an image with the same dimensions (cropping a bit as needed).
This lead to the SPLOT approach that got spun out into later themes. Each site had an authoring level account. I was able, via code, when someone visited a SPLOT creation form, to seamlessly log them in to WordPress, unbeknownst to them, as this secret user.
This provided access to the WordPress media uploader, which was a simple means to put images into the site. I put into play the Remove Dashboard Access plugin, which redirected anyone logged in as an Author role away from the dashboard. And I added some CSS which hides the WordPress authoring menus.
Yes, this was one of those Grand Kludges. But it worked well for years, and went into the TRU Writer, TRU Collector, and the SPLOTbox themes. Still, the approach presented some problems for other people trying to use the themes:
- A tedious task to create a new fake user, check for it, run the login scripts, and passing them back and forth from a Welcome Desk page (to check for an access code) and back to the creation form
- And it’s more problematic on WordPress Multisite. I have to add logic to deal with situations where someone is logged in to their own site. And if you are not a system admin, it’s not easy or maybe even possible, to add this user who would exist in the overall users table, to a new site. Colin Madland called it out
- It added a lot of extra code and templates to the theme
- It was the equivalent of cheap duct tape.
It was only a year ago that I was able to tackle this first on TRU Writer, the first SPLOT to go authorless. It came from some fiddling with a jQuery dropzone file uploader for another project, powered by some under the hood ajax code I cobbled to take the file saved in a browser session, and insert it into the WordPress Media Library the same way it works when logged in. It meant redoing about 80% of the creation form processing, using some sneaky tuff to generate previews.
I was able to make similar changes in a few weeks to the SPLOTbox theme. but alas, it was almost a year until I sat down to re-jig TRU Collector.
It’s available now to try at http://splot.ca/collector and if you are brave and manage your own domain, you can download an updated version of the theme from Github. A worthy relative new feature in WordPress is that you can update a manually installed theme the same way you first installed it- by uploading the updated version of the theme as a .zip (it’s insane to imagine it took this long, but who am I to complain)?
See the newest item created author-lessly… I did get the word out in twitter, and clink clink come the likes and retweets. But hey…
Jump in please and give the new TRU Collector a go. I’d like to make sure it’s working so we can have Reclaim Hosting push out updates to people who used their cpanel installer.
I’ve slipped a few more enhancements in! Because of the way WordPress resizes animated GIFs, if you uploaded one bigger than 500px, it would animated on a single view page, but the front page thumbnail would not (because it downsizes a GIF to a non-animated JPEG).
But in this new version, the 600px wide Cartman GIF in the entry post is also moving on the home page. Previously the thumbnail on the front was inserted the standard way, telling WordPress to use a specific size image
the_post_thumbnail( 'post-thumb' );
I found a wee bit of code in Stack Exchange that got em clued in on how to get the mime type for an image in the media library. So now I can test the featured image to see if it’s a GIF, and if so, we use the full/original size.
$thumbnail_image_size = ( get_post(get_post_thumbnail_id()) ->post_mime_type == 'image/gif' ) ? 'full' : 'post-thumb';
It’s the little things that animate.
But wait… there’s more. WordPress gives you a standard setup for comments like this:
But I have a idea for a site where I want to have a different title, and maybe even a place to add a custom prompt for the comment form. This is now a feature in this theme (and also TRU Writer and SPLOTbox):
I’m pretty excited to get these changes in for TRU Collector, specially on finding in the last few days more ways other people are using the theme.
But here I am in six years down the road from the first SPLOT, ripping out the first feature I put in. That’s progress!
So long secret Author accounts!