WP plugin: Download Manager
Download Manager (now in beta testing) is a WordPress plugin that provides the ability to restrict and track file downloads from your site, and manage it all through a single interface in WordPress’ administration pages.
(If you downloaded the alpha, see the update)
Finally! Finally! And yet it’s only an
alpha beta release! Admittedly Download Manager is not the most frustrating plugin I’ve worked on, but it’s definitely in the top 2. I guess your first plugin that hooks into the admin pages is like that. Anyway, for those looking to try it out download the zip file (linked through Download Manager, naturally), extract download-mgr.php from it, place that file in your plugins directory (wp-content/plugins/), and activate “Download Manager” under Plugins in WordPress.
Using Download Manager for, well, downloading, is as easy as providing a link. In fact, all there is to it is linking to files in this manner:
?dl is what “gets” Download Manager to retrieve and download the file, which is specified in the value for dl=. If there’s a file called archives.zip in your downloads directory, you can link to it for downloading like so:
An anchor link would look like:
<a href="/?dl=archives.zip">Download my zipped up archives</a>!
You’ll need to tell Download Manager where the download directory is, but before explaining how to configure things and let you be on your way, there’s one user variable in the plugin you may want to modify, depending on how you choose to track downloads, if at all. After the example dl links near the top, look for this section:
// user-configurable variable >
// Set $tracking_type to have Download Manager use a single table to
// track downloads, multiple tables (one per blog), or do not track.
// Valid value: 'single', 'multiple', 'none'
$tracking_type = 'multiple';
// < user-configurable variable
$tracking_type tells Download Manager how to retain tracking records. The setting of ‘multiple’ (the default) creates a table using the table prefix defined in your wp-config.php. If this is the default on a blog, then the download table with $tracking_type set to multiple will be ‘wp_downloads’. Setting $tracking_type to ‘single’ tells Download Manager to ignore the table prefix and create a tracking table with the name ‘downloads’. Using ‘none’ effectively disables tracking and Download Manager will not create a table for it.
This let’s you manage download tracking in a multi-blog environment any number of ways. For an example, let’s say you have 4 WordPress blogs on a single host; 2 of the blogs share their resources; 1 is a subscription blog accessible only to registered users; the last is your personal blog but also has registered users, and though you don’t need to track downloads you do want to make certain files avaliable to them. The first 2 can track downloads together by setting $tracking_type on both to ‘single’, so they’ll use a common ‘downloads’ table. On the subscription blog, setting it to ‘multiple’ creates and uses a table just for it (with its predefined prefix). And for your personal blog using ‘none’ turns tracking off, but you’re still able to restrict downloads to users.
With that out of the way, let’s take a look at Download Manager’s admin page. After activating the plugin, you’ll find it under Manage > Downloads in WordPress. (Click images for full version)
You’ll note at this point Download Manager is not quite ready to go about its business. It’s performed some guesses for settings which may need to be changed. They’re also not yet retained as WordPress options. Spend a few moments here making sure everything is as you want it, then click Add Settings.
Download path is the full (absolute) directory path to your download directory, starting from the root of the server your site is hosted on (and not the root of your web site). The path Download Manager generates should help guide those who are uncertain about the full path. Download URL is the url or web address to your download directory. This won’t be advertised when a file is downloaded, but it’s required all the same.
Access level is for setting a restriction on the user level allowed to download. User level is the numeric Level value for each user/author under Users admin. If you want to allow absolutely everyone to download with no restriction, select ‘public’.
The Report errors checkbox sets whether to use restricted access error messages, or to return no error and just quit on the download attempt. The Wrong level message displays if a user/author with a user level below the one allowed tries to download, and No login is for when restrictions are set but the download is initiated by a non- or logged out user.
The above is a screen shot of Download Manager in normal view. This is how it typically appears when first visiting the admin page, with settings on top, and the tracking list at bottom. You can temporarily modify this by clicking the “Tracking only” link at top right.
And this is Download Manager in tracking view. Right now it only displays a line for each file, with the number of downloads (count). The rest of the information is for the last download of that file: login of the downloader if there’s one, referring page for the link, IP of the downloader, and date/time of the downloaded.
The purpose of releasing Download Manager now is to put it through some real world testing, as well as get feedback as to what may be missing. It’s unlikely anything more than munged downloads or failed responses from the plugin will occur, but keep in mind I consider this an
alpha beta release. I’m not recommending it to anyone who can’t figure their way around WordPress and their host’s MySQL admin tools. If you run into problems beyond the plugin’s functionality, I’m afraid you’re on your own.
alpha beta, note that certain features and functionality are still in the works for R1 final. Some things I’m looking at are: have Download Manager completely remove all restricted access message settings when Access level is set to ‘public’ (they’re just in the way then) (done); click-through links for fuller tracking reports by file name (done); ability to “empty” the tracking table of records for individual files. Let me know if you have any suggestions beyond this (but nothing fancy, OK?).
- A search is performed for the queried file in subdirectories of the download directory. So you can now organize files in subdirectories (and subdirectories of subdirectories, and so on) while using just the file name in your download query. You will need to specify the path to a file if you have more than one file with the same file name.
- File names under Download Tracking link to a Full Tracking view of all downloads for that file. To return to (summary) Tracking view, click the [«] link at the end of “Download Tracking: filename [«] .”
- Restricted access message settings are not displayed when Access level is ‘public’
- Minor admin page tweaking.
If you have problems with this version, I’ve kept the alpha online: download-mgr-alpha.zip
Planned features still on the drawing board: paging for Full Tracking view; clear individual files from tracking table; localization of admin page (beta is basically localization-ready; just need to provide a POTS file). These should make it into the final.