WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm using this plugin (http://wordpress.org/extend/plugins/wp-downloadmanager/) as my download manager. While it's very simplistic and does great for what i need, the statistics to output on the site lack a little.

The only useful function really is: Display Most downloaded (of all time). While i do use this, it would be handy to have a Most downloaded this week or this month as new files get lost on the all time ranks.

I've dug through the code and found this query for the most downloaded function:

$files = $wpdb->get_results("SELECT * FROM $wpdb->downloads WHERE file_permission != -2 ORDER BY file_hits DESC LIMIT $limit");

I'm not sure if it's possible as i haven't a clue about mysql but can we simply add something to that line to query most downloaded files during this week or month?

More info on the plugin here: http://lesterchan.net/wordpress/readme/wp-downloadmanager.html (Click on the usage tab)


share|improve this question
up vote 0 down vote accepted

Simple answer: No.

Complex answer: After looking at the plugin's source code, the downloads table used to store the stats is not structured such that you could just edit this single query to give you that kind of information. It would take a much more extensive rewrite of the plugin to handle your request.

Possible Workaround: The plugin has a function called get_recent_downloads which looks like it outputs a list of the newest files.

share|improve this answer
Thanks for the info. Shame that the author didn't write it in a way to allow such a function. Never-mind. – Blackbird Feb 21 '11 at 18:30

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.