WordPress Download Monitor 3 Documentation

dlmhelp

I have had some requests asking me to improve the WordPress Download Monitor documentation, so I decided to write (and maintain) this post explaining the ins-and-outs of configuring and using the plugin. Hopefully it will help you guys use the plugin, and also reveal more of its power and flexibility.

Don’t forget, if you love download monitor please make a small donation and/or rate it on the wordpress plugins directory. I also appreciate your contributions to the development of the plugin, so feel free to email me any code or your suggestions. Your support is very welcome!

Links: Download Monitor Page | Plugin Directory Page

Installation

If you have not already installed it, to install download monitor unzip the plugin file and put the download-monitor folder into your plugins directory. Activate it and your away. Once activated Download Monitor will create the database tables and set things up.

You will find the admin interface for download monitor on the top level menu listed as ‘Downloads’.

Configuring Download Monitor

Go to the Downloads > Configuration page. Here you will find the following sections.

Download categories

You can categorise downloads using the categories you define in this section. Note that they can be nested. Each download may have only one category. To add a category, input its name and choose a parent (if you want to nest it), then click Add.

Note each category has an ID; this is how you will reference the category when displaying them in posts.

Custom Output Formats

This is where you define how your download links will look. Custom formats should be written as HTML and also use special ‘tags’ which get substituted for download information when shown. The following tags can be used when defining a custom format; each is replaced with the download’s information.

  • {url} – Url of download (does not include the actual hyperlink)
  • {version} – Version of download
  • {version,"before","after"} – Version of download. Not outputted if none set. Replace “before” with preceding text/html and “after” with succeeding text/html.
  • {title} – Title of download
  • {size} – Filesize of download
  • {category,"before","after"} or {category} – Download Category. Replace “before” with preceding text/html and “after” with succeeding text/html.
  • {hits} – Current hit count
  • {hits,"No hits","1 Hit","% hits"} – Formatted hit count depending on hits. % replaced with hit count.
  • {image_url} – URL of the download image
  • {description,"before","after"} or {description} – Description you gave download. Not outputted if none set. Replace “before” with preceding text/html and “after” with succeeding text/html.
  • {description-autop,"before","after"} or {description-autop} – Description formatted with autop (converts double line breaks to paragraphs)
  • {date,"Y-m-d"} – Date posted. Second argument is for date format.
  • {meta-key} – Custom field value
  • {meta-autop-key} – Custom field value formatted with autop

For example, if I wanted to output my download with an image button I would use the following custom format:

<a href="{url}" title="Downloaded {hits} times"><img src="{image_url}" alt="{title}" /></a>

In this example I output a download link, with it’s title as the link text, followed by a description:

<a href="{url}" title="Downloaded {hits} times" >{title}</a> - {description}

Like categories, custom formats are referenced by ID, not by name.

Using custom formats gives you the flexibility to output downloads however you please, be it as links, list items, or table rows – the sky is the limit.

Custom Download URL

This option allows you to mask the download URL to something that looks a bit nicer. By default the download url will be something like:

http://yourdomain.com/wp-content/plugins/download-monitor/download.php?id=1

By entering something in the first input box you can mask the first part of the link. For example, if I added downloads/ as the custom url my links would look like this:

http://yourdomain.com/downloads/1

The dropdown option (which defaults as ID) chooses the final part of the link. For example, if I selected ‘filename’ from the dropdown and clicked save I would now have links like this:

http://yourdomain.com/downloads/filename.zip

Important: Do not make the custom url match a real url e.g. do not call it downloads/ if you really do have a directory called downloads on your server, because this will cause conflicts and break your links.

You must re-save your permalink settings after updating custom urls for your settings to take effect.

General Options

  • “Download not found” redirect URL - (optional) If set, when a download is not found the user will be redirected here.
  • Member-only files non-member redirect: - (optional) If set, if a user tries to download a member only file and is not logged in they will be sent to this page.
  • Download image path – The path of the image for the {image_url} custom format tag.
  • Default output format – (optional) The custom format to be used if you don’t specifically reference one when outputting a download.

Recreate Download Database

If you experience problems, such as not being able to add a download, it may be the database at fault. This option reinstalls the database tables (backup your database before using this function).

Top

Adding & managing your downloads

Downloads can be added in one of three ways;

  1. Using the Downloads > Add New page to upload and add a file.
  2. Using the Downloads > Add Existing page to choose an already uploaded/remotely hosted file.
  3. Using the uploader on a posts screen (see section below: ‘Using the post page uploader’)

The ‘add download’ forms should be pretty self-explanatory, however, I will explain custom fields and member only files in a little more detail. New downloads are uploaded to the wp-content/uploads/xxxx/xx directory (like images are when inserting images into posts).

Custom fields allow you to define additional data about your downloads – just add a ‘name’ and a ‘value’. You can then reference this data using custom formats ({meta-key} and {meta-autop-key}). They have all kinds of uses, for example, if I wanted to include a thumbnail for each download I could add a custom field called ‘thumbnail-path’. I could then use a custom format to output the thumbnail like this:

<a href="{url}" title="Downloaded {hits} times"><img src="{meta-thumbnail-path}" alt="Thumbnail" /> {title}</a>

Each download can have as many custom fields as you want.

The Member only file option, when enabled, only allows logged in users to download the file in question. If they are not logged in they will see a message telling them this *or* will be redirected to the Member-only files non-member redirect url set on the configuration page.

One handy additional feature with member only files is that if you give a download a custom field called min-level; the user will need to be this level or higher in order to access the file.

Viewing, editing and deleting downloads

All downloads can be viewed on the main download monitor admin page (as well as hits) and can be edited by clicking the edit icon on the right. The edit screen works in a similar fashion to the add download page. You can also delete downloads from here – this also removes the file from the server if you uploaded it via the ‘Add new’ page.

Download Logs

The Downloads > Log page shows a list of recently downloaded files, along with user ID’s/IP addresses. This is not used for stats so the log can be safety cleared using the ‘clear log’ button if you wish.

Download Stats

It has already been mentioned that you can view hits on the view downloads page, however, if you visit your admin dashboard you will notice two additional stats widgets. One shows the top 5 downloads, where the other lets you select a date range and a download to view daily/montly download stats.

widget-screenshots

widget-screenshots

Using the post page uploader

On the wordpress post screen you will notice a small ‘arrow’ icon near the insert image button above the editor – this allows you to access download monitor conveniently when posting.

uploader-icon

uploader-icon

From this screen you can add a new file (and insert into the post), or by clicking ‘view downloads’ you can see the list of files and click ‘insert’ to insert them into your post.

Note: It is normal for the inserted code to look something like [download id="1"]. This is parsed when the post is viewed.

Top

Outputting your Downloads

Download monitor provides a variety of ways to output your downloads in your pages, posts, or templates.

Shortcodes

Shortcodes are the best way of including downloads (these replace many of the legacy tags shown later).

Outputting a single Download

[download id="1" format="1" autop="false"]

This shortcode outputs a single download of your choosing (set the id), with an optional custom format (replace the id in ‘format’), and an optional autop (true or false; false prevents wrapping the outputted content in p tags and is default). Valid examples:

[download id="1"]

[download id="2" format="2"]

Outputting multiple downloads

[downloads query="limit=5&orderby=rand" format="1" wrap="ul" before="&lt;li&gt;" after="&lt;/li&gt;" autop="false"]

This shortcode retrieves and outputs multiple downloads in posts. All of the options are optional.

‘query’ takes a query string containing a variety of options (see the get_downloads() function below; they use the same query string format). By default it retrieves 5 random downloads. A common request is showing a category using this shortcode; to do that you can add &category=1 (replacing 1 with the category ID) to the query string.

‘Format’ take a custom format ID to change how the downloads of outputted.

‘Wrap’ by default wraps the downloads in a unordered list; you can set this option to be blank if you want to wrap it with something else (like a table).

‘Before’ and ‘after’ are what each download will be wrapped in (by default this is a list item). If you modify these values you must ensure the code you insert is encoded e.g. replace < with &lt;.

‘autop’ can be true or false; false prevents wrapping the outputted content in p tags and is default.

Valid examples:

[downloads]

[downloads query="limit=5&orderby=hits"]

[downloads query="limit=5&orderby=hits" format="2"]

[download query="limit=5&orderby=hits" wrap="" before="&lt;p&gt;" after="&lt;/p&gt;"]

Show a special download page

Use the [download_page] shortcode. See the ‘download page’ section for more info.

Parsing shortcodes in templates

Did you know you could output shortcodes in places other than posts? Just wrap your shortcode in the do_shortcode() function. Example:

do_shortcode('[download id="1"]');

get_downloads() template function

This function returns downloads that match your query; it takes 1 argument containing the query string. The defaults are as follows:

'limit' => '', 'offset' => 0, 'vip' => 0 'category' => '', 'orderby' => 'id', 'order' => 'ASC'

As with many of wordpress’ functions, construct your query string using the above attributes linked together with an ampersand (&), e.g. limit=5&orderby=hits&order=desc.

limit‘ takes an integer and will return that many posts.

offset‘ takes an integer and will offset the returned posts by that number. e.g. offset of 1 would not return the first result.

vip‘ can be 1 (true) or 0 (false); if set to true, only downloads you have permission to access will be displayed (non members will not see member only downloads).

category‘ takes a comma separated list of category id’s and returns downloads in those categories.

orderby‘ orders the downloads. Valid options for this include id, hits, title, date, filename, and random. NEW: can also be ‘meta’ (but you must also add meta_name to the query).

meta_name‘ define the meta field to sort by when using orderby=meta. Only downloads with this meta field will show.

order‘ can be ‘ASC’ for ascending, and ‘DESC’ for descending.

get_downloads() returns an array object with the following data:

  • size
  • url
  • title
  • version
  • hits
  • image
  • desc
  • category
  • category_id
  • id
  • date
  • memberonly

Usage Example: (Output a list of top downloads)

$dl = get_downloads('limit=5&orderby=hits&order=desc');
 
if (!empty($dl)) {
    echo '<ul class="downloadList">';
    foreach($dl as $d) {
        $date = date("jS M Y", strtotime($d->date));
        echo '<li><a href="'.$d->url.'" title="'.__('Version',"wp-download_monitor").' '.$d->version.' '.__('downloaded',"wp-download_monitor").' '.$d->hits.' '.__('times',"wp-download_monitor").'" >'.$d->title.' ('.$d->hits.')</a></li>';
    }
    echo '</ul>';
}

Top

FAQ

Can I upload .xxx filetype using the uploader?

Download Monitor uses the WordPress uploader for uploading files, so any format supported by wordpress is allowed. If you have trouble adding a specific file due to its format you should try PJW Mime Config – it allows you to add mime types so wordpress allows you to upload other filetypes.

Can I link to external downloads?

Yes, but the “force download” option might not work. Test it out.

I want a download page like yours!

Use the download_page shortcode.

I want other users (other than admin) to use download monitor. Can I do this?

Yes, but you need another plugin. Its called ‘capability manager’.

I want to change the way my links look/I don’t want “hits” to show

You need to use custom formats (these change the way links are output). Go to the config section to create custom formats – you will need to know HTML.

My Downloads don’t work or the download page is not found/error 500′s, wtf?

Several things can cause this. First things first – check the plugin folders permissions. The folder and files should be readable – especially download.php so check! Also, avoid setting to 777 at all costs. Second, resave permalink settings – this can often cause hiccups. Also, check the path to the download is correct by editing it – try entering the url directly into the address bar. If its not found, you cannot blame the plugin!

If your on a Windows host then when *any* php error is found it throws an unhelpful 500 error. You may get one when activating the plugin. If you do encounter such errors, and your are running php4, switch to php5 to see if the error disappears.

My hits are not showing up! Help?

Admin hits are not counted, log out and try! Also ensure that if you have set the ‘custom url’ option that the custom url does not actually match the physical location of the file.

I have wordpress installed in a sub directory and my downloads don’t work

Go to settings > misc in wordpress admin and check the ‘Store uploads in this folder’ setting is correct. Sometimes wordpress screws this up. You may also notice that normal uploads in wordpress (e.g. via the media panel) don’t work correctly either if this setting is wrong.

I want my downloads to be parsed in a custom field using get_post_meta(), can I do this?

WordPress does not have a filter I can hook into for this function, so to make this work wrap it in the relevant functions. For old style download links ([Download id not defined]) use wp_dlm_parse_downloads() else use do_shortcode(). For example:

echo do_shortcode(get_post_meta($post-&gt;ID, 'Download', true));

Top

Download Page

I gave in. I was going to release this as a paid add-on, but I’ve changed my mind because I trust you guys to make donations to ensure support continues for this plugin. So here we go; the download page addon (as seen on this site in the ‘Downloads’ page) is now built into download monitor (version 3.1 +). The download page includes a sorting, pagination, and search function.

Usage

To create a download page, first create a wordpress page (or post) and insert the following shortcode:

[download_page]

Easy huh? But theres more. This shortcode has the following options:

  • base_heading_level (integer) – Category headings on the page are this level. Defaults to 3 (h3)
  • pop_count (integer) – How many popular downloads to show.  Default is 4.
  • pop_cat_count (integer) – How many popular downloads to show per category. Default is 4.
  • show_uncategorized (integer) – Set to 1 (default) to show an uncategorized section, or 0 to hide it.
  • per_page (integer) – How many downloads to show per page. Default is 20.
  • format – ID of custom format to use.
  • exclude – Comma separated list of downloads to exclude from the listings.

So for example, to show 5 popular downloads I’d use:

[download_page pop_count="5"]

Easy peasy.

Customisation

So you want to customise the look? You can probably do that with CSS, either in your themes CSS file or by customising the styles.css which came with the plugin – this is found in download-monitor/page-addon/styles.css.

If for any reason the output looks unstyled completely, your version of wordpress may not support the way I added the styles.css file, so just paste the css code from that into your themes css file.

Configuring Download Data

The download page add-on is smart and uses your downloads custom fields to show the information. It lets you show an unlimited amount of custom fields like this:

  1. You add custom fields to a download, for example, ‘licence’ with value ‘Free (GNU General Public License)’.
  2. You then add a custom field called ‘include_fields’ and list the names of the fields to include on the download page separated by commas, e.g. tags,licence,wordpress-plugin-directory-page,documentation.

There are a few reserved custom field names you can use too:

  • post_id = add an id of an associated post to the download – the read more link on the download page will link to this post.
  • side_content = some content to show underneath the download link. On my site ive inserted some adsense code.
  • thumbnail = path to an image for the download’s thumbnail. 112×112 is ideal for this.
  • hide_download_button = Won’t show the download button. I’ve done this for my paid icon set because they cannot be downloaded from the site.
  • hide_hits = Hide hit count

Finally, remember I did not have to release this add-on for free, so please consider making a donation to ensure I continue developing download monitor in the future.


Top

Found this post useful? Why not buy me a coffee!

Related Entries

1,244 Responses to “WordPress Download Monitor 3 Documentation”

RSS feed for comments on this post.

1 ... 35 36 37 38 39 ... 50
  1. philippe Poivre says:

    Hi,

    I have upgraded to the latest version. I don’t see anymore the “downloads” button in the editor… Is there a way to have it again?

    Thanks agains for the great work !!!

    ReplyReply

    Comment made on March 17, 2010 at 11:24 am

  2. Mike Jolley says:

    @Darko: They are in legacy_shortcodes.php since they are older functions I believe.

    @amin: Categories don’t have icons.

    @Jen: No not yet – had no time for it.

    ReplyReply

    Comment made on March 17, 2010 at 3:55 pm

  3. Mike Jolley says:

    @philippe Poivre: De/reactivate. It may have disappeared due to user permissions.

    ReplyReply

    Comment made on March 17, 2010 at 3:56 pm

  4. Li-An says:

    I will probably move my dowload page to a new blog. How to manage this without loosing all data of the plugin ? Just copy the database will be OK ?

    ReplyReply

    Comment made on March 17, 2010 at 6:40 pm

  5. philippe Poivre says:

    Thank you Mike, Nut deactivating it and reactivating it didn’t change…. I resaved the permalinks and no result…mmm. Do you have another clue?

    Thanks a lot

    ReplyReply

    Comment made on March 18, 2010 at 9:06 am

  6. Mike Jolley says:

    @Li-An: Copying the database tables should be fine – yes.

    @philippe Poivre: Check (chmod) the permissions of uploader.php/the other files. You should be able to see the uploader page (at least the top links) if you go directly – yourdomain.com/wp-content/plugins/download-monitor/uploader.php

    ReplyReply

    Comment made on March 18, 2010 at 9:40 am

  7. Li-An says:

    Thank you, Mike !

    ReplyReply

    Comment made on March 18, 2010 at 3:48 pm

  8. Eric Hamby says:

    Is there a way to let the user choose the mirror they want to use?

    ReplyReply

    Comment made on March 18, 2010 at 6:34 pm

  9. Les says:

    I am not a programmer but I’m trying to set up a download for my daughters CD. I have a hidden page called “download” on her website http://www.charelylaas.com (http://charleylaas.com/?page_id=268&preview=true&preview_id=268&preview_nonce=6878df3b3c).

    People who purchase the CD are forwarded to the “download” page by the auto return in Paypal. I have loaded all 7 of her songs into WordPress Download plugin only four show up on the page and if you click to download a song it just plays in quicktime.

    Is there a way to click once and download all the mp3 songs (not play) from the CD to the purchaser’s computer?

    Thank you
    Les

    ReplyReply

    Comment made on March 18, 2010 at 9:06 pm

  10. leslaas says:

    I moved this question over to the wordpress forum

    ReplyReply

    Comment made on March 18, 2010 at 9:30 pm

  11. Eric says:

    I’ve been looking all over to remove the “downloaded # times” from the hover AND the counter at the end which keeps track of how many times a form has been downloaded…How do I remove these I don’t want anyone to see my download numbers. Thanks much.

    ReplyReply

    Comment made on March 19, 2010 at 7:03 am

  12. Mike Jolley says:

    @Eric Hamby: The mirror is chosen automatically – if you wanted the user to choose mirrors you would have to create a download link for each mirror. Ill add to the todo list – {mirror_1_url} etc

    @Les: Will answer on forum.

    ReplyReply

    Comment made on March 19, 2010 at 11:09 am

  13. philippe Poivre says:

    Hi Mike,

    Ok I see it if I go directly as you suggested… the permissions of the uploader.php is set to 644… My only “little problem” is that I don’t have anymore the download dropdown menu in the “new post ” writing panel…

    ReplyReply

    Comment made on March 19, 2010 at 11:49 am

  14. Mike Jolley says:

    @philippe Poivre: 644 is too low – try 744.

    ReplyReply

    Comment made on March 19, 2010 at 11:56 am

  15. kilian says:

    hello mike,

    thax for this great plugin!

    one suggestion:
    a drag’n drop sorting in the backend (which could be used by orderby=sorting or so) would be fantastic!

    ReplyReply

    Comment made on March 19, 2010 at 2:48 pm

  16. philippe Poivre says:

    Thank You Mike for your generosity… and sorry for my “distraction”…. I just noticed that the “download” button is no more a dropdown menu but an “arrow”…. And Waow !! this new window is GREAT !!!

    Thank you again for your effort,

    All the best

    ReplyReply

    Comment made on March 19, 2010 at 4:13 pm

  17. terminatorbin says:

    hello mike,thax ur greate work
    one question that i want to ask to u is that when i upload my file to my wedhost and add the download url into my article it can’t display correctly.it says “Download id not defined”,i don’t know how to solve it.can u help me solve the problem?

    ReplyReply

    Comment made on March 19, 2010 at 5:55 pm

  18. Mike Jolley says:

    @terminatorbin: Check the FAQ topics and that your using the shortcode correctly/the ID is correct. It should be a number, just in case.

    ReplyReply

    Comment made on March 19, 2010 at 7:23 pm

  19. terminatorbin says:

    @Mike Jolley:
    thank you for your Answer,mike.i know what’s the matter about it,i was write the shortcode in Article Mode before and now i write it under souce,so the problem solved.ha-ha

    ReplyReply

    Comment made on March 20, 2010 at 2:05 am

  20. Eric Hamby says:

    That would be a great feature. Not sure how your trying to explain hoe to do it now though.

    I thought about adding it to the plugins custom fields but if i do it wont count on the download counter.

    ReplyReply

    Comment made on March 20, 2010 at 5:20 am

  21. Josh Arcadia says:

    Ugh! hate when I spend 3 hours trying to figure out a plugin:
    How can I add a file with image+name?
    I like this 2 formats, but I need Thumb+Name
    - [download#1#image] <– Has image but no name
    - [download id="1"] <– has name but no image

    what can I do?

    ReplyReply

    Comment made on March 20, 2010 at 5:38 am

  22. Mike Jolley says:

    @Josh Arcadia: Getting started section above =

    Custom Output Formats This is where you define how your download links will look. Custom formats should be written as HTML and also use special ‘tags’ which get substituted for download information when shown.

    ReplyReply

    Comment made on March 20, 2010 at 12:47 pm

  23. Josh Arcadia says:

    @Mike Jolley:

    Thanks for your answers, nca you give me an example for my issue?
    I always read before posting, and tried [] {}
    and nothing…

    ReplyReply

    Comment made on March 20, 2010 at 3:14 pm

  24. Mike Jolley says:

    You need to declare the format in WordPress Admin > Download Monitor > Config – then add the format attribute to the shortcode.

    ReplyReply

    Comment made on March 20, 2010 at 3:16 pm

  25. Josh Arcadia says:

    Ok did and nothing, can you show me a shortcode i.e.
    [download#1#image] what else?
    I’m I will donate :)

    ReplyReply

    Comment made on March 20, 2010 at 3:29 pm

1 ... 35 36 37 38 39 ... 50

Leave a Reply

About this site

Blue Anvil is the online web design journal & portfolio of , a web designer from Norfolk, England. Read More »
MiniCard Theme for WordPress
  • Featured work - More

    • Beefjack
    • Integrity
    • theotaku.com
  • Latest Tweet - More

    • RT @jameskoster: #Vector illustration of the new #iPod nano, free to download; http://www.potatoestomatoes.co.uk/technical/free-ipod-nano-vector/
  • Out of the blue - More

    • Closing the Forums

      Just posting to let current users know that I’m closing the forum on Blue-Anvil. This is mainly due to spam-registrations getting out of hand and being a general nuisance. I will be posting good topics as FAQ items within posts if applicable.

      Please note that you can still post and get help for my plugins/themes by posting on the wordpress.org website.

    • Show off your MiniCard!

      Are you a user of the WordPress MiniCard theme? Its been downloaded over 14,000 times so far!

      If you have used it as-is, made your own child-theme or done something creative with it, please show off your MiniCard’s in the comments, I’d love to see how the theme is being used!

    • Spam Stopper updated for WordPress 3.0

      My Spam Stopper plugin has been updated for WordPress 3.0 (version 3.1.3) – you can grab it here. Sorry this update took longer than my other plugins but this one gets less lovin’ – if you want to change that feel free to donate, spread the word, or rate it on the WordPress.org plugin page.

    • SexyBookmarks & Tr.im

      Just a notice to users of the brilliant http://www.sexybookmarks.net/ plugin by shareaholic – If you use tr.im (as I have on a few client sites) be aware tr.im has ceased operation so you may see errors on your blog or in your source code; it screwed up the background and headings on one of my blogs.

      To fix, go to sexybookmarks options, switch services in the “Which URL Shortener?” box, and tick the box to reset all short urls. Once done, your blog should return to normal.