WP-DownloadManager – Query most download per week/month etc

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.

Read More

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)

Thanks

Related posts

Leave a Reply

1 comment

  1. 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.