Download Monitor 3.1.5 [Posted Date Bug Fix]
This is one of the best WordPress plugins I have come across. It’s simply awesome. You can manage all your downloads on your blog/website with this plugin and moreover you get all the stats you need for the download. Moreover, it maintains the log of all the downloads with information like IP Address of the downloader, Date & Time of the download and which file was downloaded.
Anyway, I think I am diverting from the main thing that we are supposed to do.
In this release of the plugin i.e. version 3.1.5, those of you who are using might have seen that whenever you add the download, the ‘Posted Date’ shown is the 1st of Jan 1970. I ‘googled’ quite a lot for finding a fix about the problem but phew!, no success.. I found many links which contained the disturbed user posting the problem and requesting for a solution. But no link contained the answer.
So finally, gathering some courage, I decided to decipher the code and try my best to fix the issue. I started with sub folder ‘download monitor’. I checked almost all the files but finally the useful file was the one that was the last file in the folder, ‘wp-download_monitor.php’. Nothing else needs to be changed.
So let’s start the fun !!
Take a Backup of the whole folder before continuing…
1. If you have just stumbled across this post of mine and would like to try the download monitor on your website, you can download it from Download the plugin
2. Extract the contents from the zip file.
If you are not a coder or you don’t have that much time to do the code changes as explained below, you can download the modified file: Download Monitor [Posted Date Bug Fix] File Downloaded 235 times.
3. Open the folder that you have extracted. You should see a folder named ‘download monitor’. Open the folder and navigate to the file ‘wp-download_monitor.php’. It will be the last file in the folder.
4. Open the php file with any text editor you want.
5. DON’T PANIC !!! I know that the code is toooooo big… about 3400 lines… Hats off to Mike Jolley – the Developer !! I won’t explain the whole code but only what is needed for us to fix the problem.
6. Press ‘Ctrl + F’, the shortcut key to ‘Find’.
7. Now enter this in the search box (without quotes i.e. from opening ‘<’ to the last ‘>’):
“<input type=”hidden” name=”postDate” value=”<?php echo date_i18n(__(‘Y-m-d H:i:s’,”wp-download_monitor”)) ;?>” />”
8. Found it.. !! You have hit a jackpot my friend !!
9.Select the whole statement i.e. starting from the “<input type=”hidden” ……to….. ;?>” />”
10. Replace it with the following (without quotes i.e. from opening ‘<’ to the last ‘>’):
“<input type=”hidden” name=”postDate” value=”<?php echo date_i18n(__(‘Y-m-d H:i:s’,”wp-download_monitor”), strtotime($d->date)) ;?>” />”
11. Repeat the above process till you find the matching text.
12. In the whole file you would be able to find this text 3 times. If you have the line numbers enabled in the text editor, the line nos. are 1253, 2215 and 2431. This will help you to crosscheck and confirm that you are replacing the right lines of code !
14. Save the file, replace it and that’s it !! You are done ! Now onwards the correct date will be attached with the download. Try it just now !!
PS: The changed code has been tested for about 3 days and I haven’t faced any problems until this second. Still if for some exceptional case the changes don’t work or you face any problem, feel free to contact me any time. Just leave a comment or mail me at email@example.com. Moreover, I won’t be responsible if anything goes wrong.