Download Counter for Wordpress

I’m crazy about numbers. I won’t do anything with them, but I just like them. Just like to watch counters increase, or graphics to grow. Since WordPress does offer attaching downloads to pages, but doesn’t keep track of statistical information about these downloads, I wrote this plugin.

I should mention statistical information is a big word for just another download counter, since that is main purpose of this plugin.

Features:

  • Keeps track of the amount of downloads of a certain file.
  • Keeps track of the last download time
  • Allows you to reset the counter
  • Allows you to add counters to both internal and external urls
  • Can use fancy urls (like /downloads/file.zip)
  • Can print the amount of downloads in a post.

Installation

Download the zip-file and extract the wp-downloadcounter directory to you wp-content/plugins directory. Go to the plugins page in your wordpress administration panel, and Activate the Download Counter plugin. On Activation, a table with the name [$prefix]downloadstats gets created, and two options will be added. The table nor the options will be removed when deactivating the plugin! After activation, it is important that you update the Permalink Structure. You can do this at your Site administration, under Options.

Management

After activating the plugin, you can manage the downloads under Management -> Downloads. Choose Add Download to add a download to the list. In the topmost editbox, you should fill in a unique name, since this name will be used in the created url. In the second editbox you should fill in the target URL. Click Save and the download is added to the list. The overview window allows you to reset the counters for a download, to edit a download (which will not reset the counters) and to delete a download. Of course, when deleting a download, only the download counter for that download will be removed, the file at the target URL will not be removed.

Using tags in your posts

When writing a post or a page, you may want to add the URL or the amount of downloads in your post. Using [ download(downloadname) ] (without the spaces) will be replaced with the download url, [ downloadcounter(downloadname) ] will be replaced with the amount of downloads. When creating a link, you could, for instance, use <a href="[ download(file.zip) ]">Download</a> (of course, again, without the spaces within the [] brackets).

Downloading

You can download this plugin here. This plugin has been downloaded 1395 times. If you have any comments (nice or not), please don’t be shy. Post them on this page!

Changelog

2008-03-19

  • Local downloads are now handled by the script, so that the filename can be send to the browser. This should prevent the browser from download .htm or other named files.
  • Changed some PHP tags which could cause errors on some configurations.

2007-07-08

  • Fixed bug posted by Steve in the comments (thanx to Dave for submitting the fixes).
  • Added a second table to store the ip-address, referer and date/time for each download.
  • Added a configuration section to change the settings.

45 Responses to “Download Counter for Wordpress”


  1. 1 Dzamir

    Grats for the blog! You missed an info page with your email, can you please contact me? :)

  2. 2 Steve

    I’ve installed the plugin per the directions, but when I try go to the Manage area, I’m getting the following error message:

    Parse error: syntax error, unexpected ‘;’ in /home/sgvhumane/public_html/runamutt/wp-content/plugins/wp-downloadcounter/downloadcounter-options.php on line 48

    Any thoughts? I’m running the latest WordPress - 2.2.

  3. 3 Dave

    Steve, I got the same error.

    Line 48 can be fixed by editing downloadcounter-options.php and adding an extra closing parenthesis to the urlencode statement.

    Find: $_POST[’download_name’]);

    Replace with: $_POST[’download_name’]));

    Line 96 also needs to be changed:

    Find: (isset($download)

    Replace with: isset($download)

  4. 4 r-win

    @Steve, @Dave:

    Steve, I’ve noticed it, and just saw the fixes Dave submitted. Thanx, Dave :-)

    Right now, I’m about to submit version 0.2, which will also log who downloaded which file, with referer and date/time. Of course, this bug will also be fixed. Just strange that I didn’t notice it before…

  5. 5 Ryan

    I am having some problems. I cannot seem to get any of the files to be listed under “Available Downloads.” This could be my mistake (I am a novice!), but am greatly perplexed by this. Also, where do I see the stats?

  6. 6 ljames

    doesn’t seem to work for me. doesn’t show up anywhere once activated. not in the dashboard, not in options. can’t figure it out.

  7. 7 r-win

    @ljames:

    The plugin should come available under Manage at the Site Administration. I’ve choosen the Manage tab, since you’ll have to Manage your downloads.

  8. 8 Steve

    Awesome - thanks guys!

  9. 9 christine

    hi R-win,

    I keep getting this error… any advice on how to fix it?

    Parse error: syntax error, unexpected ‘;’ in…./plugins/downloadcounter-options.php on line 48

    Thanks. :)

  10. 10 r-win

    @christine:

    that sounds like a old version. Try the new version at http://bovendeur.org/2007/07/06/download-counter/

  11. 11 metallicpeach

    what changes do we have to make to permalinks?

  12. 12 r-win

    @metallicpeach

    No changes at all, you just have to press Update. When you press Update, WordPress will call each plugin to see if they have any redirections required. The Dowload Counter plugin does require one additional redirection, so taking this step is required after installation, and after you’ve changed the slug.

  13. 13 Adam

    Thanks for the great plug in that actually works! i have had to go through a few now and host of them produce a header issue.

    one suggestion, i had some files named the same as the folders and that produced errors, so maybe something could be don’t about bout that, or some documentation on it so people don’t think its broken.

    Thanks again.

  14. 14 Raghu Nayak

    Thanks man.

    I have been searching for this plugin from so many days. Finally I got what I wanted. Thanks for developing such a nice plugin.

  15. 15 Aypeus

    Nice plug-in! :)

    A subjection make it AJAX. Some kind of icon for the file that are linked to be downloaded, upon click, scrolls down (loads the file info and the link in a window that appears below the icon or something like that) and the amount of downloads will be showed, latest update, and maybe other stuff)

    I have seen something like my suggestion but haven’t found anything about such plug-in, this has that potential do be “that” plug-in! :)

  16. 16 Justin

    So, I have the plug-in loaded, but I can’t seem to get it working.

    Under “Available downloads” it shows the download I added. The link “without counter” works just fine (it links directly to the .zip file I have). The link “with counter” does not (it doesn’t include the whole filename, it cuts part of it off).

    Entering “[download(myname)]” into my post displays the text of the link for the “with counter”, which as stated before doesn’t work because it’s linking to a file that doesn’t exist.

    I’ve updated my permalink structure, although I am not sure what that actually does.

    Any help would be appreciated. Thanks. :)

  17. 17 canarkadaş
  18. 18 alm

    I have this error under Download-section :

    WordPress database error: [Table ‘progcom.wp_downloadstats’ doesn’t exist]
    select download_id, download_name, download_url, download_added, download_count, download_last from wp_downloadstats

  19. 19 Wieland

    Nice plug-in! But I get an error when trying to add a download. It just says:

    Cannot load

    How can I fix that? Thanks in advance!!

  20. 20 progman

    Hello,

    Very nice plug-in ! But it doesn’t work for me :-( Links generation works fine, just look this url

    http://dxgengine.progmansoft.com/?download=dxg380

    But plugin seems do nothing, maybe i do a mistake :-)
    I think ‘request’ wordpress hook probably not available in wordpress version 2.0

  21. 21 Duncan

    nice… but am having trouble. every time i download ‘with counter’, it adds 2 downloads to the count.

    why is this? can i do anything about it?

  22. 22 Till

    Hi,

    thank you for your excellent plugin! It’s just what I need for my homepage :).

    One minor problem, though - I don’t quite know if it’s a plugin bug or a problem with Firefox:

    When using the “Right-Click –> Save as” command for a file which uses the download including download counter, the file saved is a .htm file full of gibberish. In IE7 and Opera, it works just fine.

  23. 23 Adrian

    I’m having the same issue as Till. The download link generated is an .htm file, which seems to download, but I would like to have the file download in its original format (.mp3).

    I’m going to keep going, I’m sure there is an easy solution.

    Sweet plugin though! If I can get it working as I like, I would be happy to paypal you a small donation;

  24. 24 Eric Hamby

    when usin the link with a tak it never can find the file url. then when i go back to edit it, the link with the take is always changed somehow. why is it not staying like i type it in.

  25. 25 Very Nice

    Very nice plugin! Haven’t installed it yet, but I’m working on it, and by the installation notes you wrote I can see it’s one of the best plugins that does this!
    Great job!

  26. 26 Alex

    I installed the plugin as required but it won’t show the number of downloads… Any idea why?

    Page:http://www.awholeuniverse.com/design/night-theme-wordpress-theme

  27. 27 alexandru singeorsanu

    If you download this theme leave some feedback. Tell me if you like it, or if there are any improvements you would like to be made.
    [downloadcounter(wordpress_night_theme.zip)]
    <a href=”[download(wordpress_night_theme.zip)]” rel=”nofollow”>Download Theme!</a>

  28. 28 Shayanlinux

    Hi,

    I installed the plug-in as described in this post, but whenever I click on the “Add download” from the manage -> downloads I receive this error message :

    Cannot load .

    Could you please help me to solve it.
    Thanks in advance

    Cheers

  29. 29 Queru

    When I tryed to activate the plugin the next error has been dumped by Wordpress:

    Fatal error: Cannot redeclare class DownloadCounter in /var/www/viernes.org/htdocs/wp-content/plugins/wp-downloadcounter/downloadcounter-config.php on line 25

    Any idea? Thanks.

  30. 30 Queru

    # mv wp-downloadcounter wp-dcounter

    And the redeclare error has gone.

  31. 31 Queru

    Cannot load wp-downloadcounter/downloadcounter-options.php:

    Hmmmm… plugin it’s outdated?

  32. 32 Cristian79
  33. 33 alex

    After a while struggling to configure the permalink thing I got it to work, and I love it.
    Very very simple to use, nice job!

  34. 34 Webmaster Resources

    I am having a hard time installing this plugin in my blog..
    I have activated it and did the necessary operations, but nothings happening.

  35. 35 dac

    I’m get this error:

    WordPress database error: [Table ‘wp_xxxxxxx.wp_downloadstats’ doesn’t exist]

    On Downloads in Manage. :(

  36. 36 The 'sell photos online' Dude

    Hi.,

    Can someone who has got this to work lay out step by step instructions?

    I’m finding the steps to take on this page miss gaps and don’t quite explain what I need to know.

    For example, why do I need to update the Permalink structure?

    Do I link to the exact .zip file of my download or to the download page?

    Be great if these questions could be answered…

    Thanks

    Martin

  37. 37 bruuuce

    I’m having the same problem as Till and Adrian:

    “When using the “Right-Click –> Save as” command for a file which uses the download including download counter, the file saved is a .htm file full of gibberish. In IE7 and Opera, it works just fine.

    The download link generated is an .htm file, which seems to download, but I would like to have the file download in its original format (.mp3)”.

    Did anyone find a solution, please?

  38. 38 anon

    is it possible to add user’s name so you can keep track of who clicks what.

  39. 39 Queru

    The problem remains:

    Plugin could not be activated because it triggered a fatal error.

    Fatal error: Cannot redeclare class DownloadCounter in /var/www/viernes.org/htdocs/wp-content/plugins/wp-downloadcounter/downloadcounter-config.php on line 25

    I have the WP2.5.

    Thanks.

  40. 40 tyler

    Excellent plugin Erwin, it’s exactly what I was looking for.

  41. 41 arejae

    thanks for the plugin.it works great.

    @Queru: I’m using WP2.5. too and I don’t have that problem.Perhaps it because of conflict with function name using by others plugin.

  42. 42 arejae

    sorry for double posting.I just want to help @The ’sell photos online’ Dude and others that have problem.

    the easiest way to solve that problem is to uncheck the checkbox in configuration. so download links will be generated as /?download=
    no need to update permalink structure or whatever. :)

  43. 43 Kat

    Great plugin…exactly what I was looking for :D!

    I was having the same problem with the “with counter” links, but I followed arejae’s advice and unchecked the box and now everything’s perfect.

    Thanks again!

  44. 44 Mike

    Great plugin! this has been a useful plugin and we really appreciate the work put into the development.

    I have a bug/error/request to make. I’ve noticed the tracker page stops loading once you have more than 6000-7000 logs ( which is a in fact too long a log to review on one page).

    I was wondering if you can add a feature where we specify how many logs per page we want to see. Say 500 logs per page or 100 logs per page.

    Let me know if this is possible.

    Thanks in advance!

  45. 45 r-win

    Mike,

    Great idea. I’ll try to look into this within a week. The reason it’s not in there, is that I’m not getting that much downloads ;-)

  1. 1 bovendeur.org
  2. 2 DELETE YOURSELF! » Blog Archive » Полезные плагины для WordPress
  3. 3 CONTROLLA I DOWNLOAD DAL TUO BLOG
  4. 4 Wordpress Download Counter plugin | Theme Arena
  5. 5 bilgiservisim » » En iyi 240 wordpress eklentisi
  6. 6 BLOGBURGER: WordPress & SEO take away » Monitoraggio dei Download dal tuo Blog
  7. 7 Cool Links - 10-19-07
  8. 8 WordPress 推奨プラグイン一覧 - A.K.A and more ブログ
  9. 9 ExileDesigns | Webdesign, illustrations & more » Blog Archive » Friday Link Goodness #1
  10. 10 Downloads not working… WTF? | mou.me.uk
  11. 11 Garbereder.de» Blogarchiv » Download Monitor

Leave a Reply



This blog is protected by Spam Karma 2: 39 spams eaten and counting...

Bad Behavior has blocked 79 access attempts in the last 7 days.