Today I finally finished up and deployed “version 1” of the Download Monitor plugin. This is more of a re-release than an update, hence the version reset (which should also prevent automatic updates!).
If you want to update from a legacy version of Download Monitor, after installing the new version you’ll need to also install and run the Download Monitor Legacy Importer. This will handle migrating all of your data to the new format.
I’ve also re-released the page-addon as a separate plugin.
The page addon basically lets you add a [download_page] shortcode which lists all downloads on your site with categories, tags, pagination and searching. It also adds ‘single’ views for your downloads.
Because this used to be part of the main Download Monitor plugin, albeit not as good as it is now, I’ve made this a “Pay what you want” add-on so pay what you feel is fair 🙂
As mentioned in my previous post, the new Download Monitor plugin will be making full use of custom post types making legacy data unusable. To help with this I’ve created a new Legacy Importer plugin which will:
Find old downloads/meta/tags/categories
Convert them to the new format
If left enabled, map shortcodes referencing the legacy IDs to the new download IDs.
It will not:
Prevent conflicts between old and new IDs. It is recommended that you update the old shortcodes to the new IDs as soon as you can.
Import logs and custom formats (custom formats of course are gone in this version in favour of template files).
This however was no good to me; it gives you a media uploader with a sidebar and other confusing elements not relevant when adding images to fields inline.
A better solution with a custom frame
To remove the unwanted elements and to simplify the uploader you can create a custom frame (this was inspired by the header image uploader in Twenty Twelve).
This gives us a cut down version which allows upload, or selecting a file from the media library:
This also picks up the title and the button text from the button’s html (notice the data( ‘uploader_title’ ) and data( ‘uploader_button_text’ )) using data-uploader_title and data-uploader_button_text attributes respectively.
Handling multiple files
To handle multiple files set multiple to true:
Then you just need some tweaked handling on select:
Passing data to the uploader script
The largest hurdle I faced was finding a way to pass data through to the upload script. I had two reasons for needing to do this:
I needed to pass through a different post ID to attach the image to if uploading from an edit post page, but attaching to a different post (in this case a product variation in WooCommerce).
I needed to pass through a custom variable so I could pick it up via the upload_dir hook to upload *some* files to different directories.
This was largely done through trial and error but I got there in the end (thanks Justin for the debug assistance) by setting the wp.media post ID and then re-setting this everytime we open the frame.
One final note on enqueuing the scripts; if you use these on a page that doesn’t already load the media uploaders (e.g. a custom admin page) remember to call wp_enqueue_media(); This will get everything loaded into the page for you.
Overall, I’m pleased with the result and the new uploaders. I hope this post helps others implement them.
Last month WooThemes hosted their annual WooTrip. 16 staff, myself included, jetted in from all over the world (woo span 7 countries now) to meet up in Cape Town, South Africa (headquarters!) for a week of team building.
After a gruelling 11 hour flight from Heathrow (my first time on a plane so it wasn’t a pleasant experience) James, Andrew, Coen, Dan and I landed first in Johannesburg and then transferred to Cape Town on a second 2 hour flight.
Before departure I was hesitant to go to South Africa – I’d heard horror stories about crime etc. When you get to Cape Town one of the first things you see are the slums by the airport, but boy, once you get past all that (around the mountain) Cape Town is simply stunning.
We were staying in a really nice area called Camps Bay with Sea Views out front, and Table Mountain out back. The villa was awesome – a pool, nice rooms and of course an xbox and enough muffins to feed an army.
Although it felt like a holiday, we couldn’t leave all our customers standing! We had many a support sprint to keep on top of things and that wasn’t too bad – its better to do support when you can ask others around you, or have a moan and a joke about certain tickets :p
We had day’s workshop in the office, discussing ways to make Woo better for us and for our customers. This was pretty fun – we all pitched our ideas and I felt this was very productive.
Beyond work we did plenty of activities. Paintball, boat trips, wine-tasting, trips up the mountain, seeing the penguins, surfing, even football in the scorching 30 degree sun.
The food in cape town was a special treat – I’ve never ate so much steak and seafood in the space of a week. It certainly bested pot noodles and beans on toast 🙂
My favorite activity (aside from eating all those steaks) was probably the paintball – nothing beats shooting your co-workers 🙂 Sadly I was the victim of friendly fire however (looking at you Benbow).
It was really great to meet the whole team. We were able to share ideas, brainstorm and bond. For the most part we started off strangers, but by the end of the week it was like a big ninja family.
Special thanks to Adii, Mark, Magnus and Dom for organising everything and making the trip possible. I look forward to seeing what we all do next year (and by then I’m sure the family will be even bigger!).