wp-filebase-screenshot

How To Show Your Total Downloads With WP-Filebase

For a while I have been using this WordPress plugin called WP-Filebase. I use it mostly for my brush and textures packs. If you are looking for a great download manager you might want to try this plugin. Now that people have been downloading my stuff I was thinking maybe it would be cool to show my sites total downloads. So today tried looking around for a piece of code or some simple solution to show that number on my site and well so far I couldn’t find anything.

So I went back into my WordPress admin area and stared to look around. First I stared with WP-Filebase and clicked the link called WP-Filebase. If you use this plugin you will see that there is an area that shows your sites total downloads.

WP-filebase screen shot 1 from the admin area

So my next step was to download a fresh copy of the plugin and look thought the plugin files. I noticed that the URL of that page that showed my total downloads was http://www.designerfied.com/wp-admin/admin.php?page=wpfilebase_manage

This was at the end of the URL: page=wpfilebase_manage

So I went back into the plugin folder and started to look for a php file with name wpfilebase_manage or anything with name manage.

After looking around for a few minutes I found what I needed. I went into wp-filebase/classes and opened the file called AdminGuiManage.php in notepad ++ and saw the code I needed! Its located at line 166!

Here is the php I found: <?php echo $wpdb->get_var(“SELECT SUM(file_hits) FROM $wpdb->wpfilebase_files”) ?>

wp-filebase php screenshot

So with that code you can open lets say your sidebar.php or footer.php and add it to the area you want to show your sites total downloads. I haven’t tried the php for Number of categories or Number of files but I don’t see why they wouldn’t work.