How to Add Uploaded Media to WP-DownloadManager
Executing the following code will take your results and map them to values inside the WP-DownloadManager’s database:
INSERT INTO wp_downloads (file_name, file, file_date, file_updated_date, file_last_downloaded_date) SELECT wp_posts.post_title, wp_postmeta.meta_value, UNIX_TIMESTAMP(wp_posts.post_date_gmt), UNIX_TIMESTAMP(wp_posts.post_date_gmt), UNIX_TIMESTAMP(wp_posts.post_date_gmt) FROM wp_posts INNER JOIN wp_postmeta ON wp_posts.ID=wp_postmeta.post_id WHERE wp_postmeta.meta_key = 'FileName' ORDER BY wp_postmeta.meta_value
I should point out that I used the “Post Date” from the WordPress Page and copied this to all three dates inside WP-DownloadManager (file_date, file_updated_date & file_last_downloaded_date). And of course, the hit counter starts at zero. I should also point out (again) that the “FileName” custom field is unique to my configuration.
Just like that I have all of my 1,000 forms showing up in the Download Manager.
Now that they are in the WP-DownloadManager database, I need to find a way to link to the downloads from my template or add the “file_id” value to my wp_posts table. That’s because the WordPress pages that I’ve created for each form only know the file name, they don’t know anything about the Download Manager. The pages were created before the WP-DownloadManager created the “file_id” values.
MySQL allows a simple solution to this as well. Since I’ve already created a custom field called “FileName” and since this value is the same as the “file” value inside the wp_downloads table, I just need to query MySQL and pull in the associated “file_id” value.





Thank for Information
Hi, cool post. I have been wondering about this topic,so thanks for writing.
Thanks for your valuable information. I will try it……
Thank you for this post. This is what I’m looking for.