Open luisarn opened 6 years ago
Hey Luis,
If I understand correctly, you want to be able to add a version to an existing download but not make it available right away. Is this correct?
Kind Regards,
Barry Kooij
Hi Barry!
Not an existing download, I’m trying to make a newly uploaded file only available on a future date. For example if we want to announce something on 15 November I could schedule a post on Wordpress to make it public on that day but Wordpress itself can’t schedule attachments. If you know the url of the file you can download it even the associated post is not public yet. So download monitor came to rescue, because it creates a new post type and should inherits some Wordpress posts features such as scheduling, however, the current version of download monitor ignores the post date. That’s why I’m asking if you could check the post date too in the next release then we would be able to schedule attachments too.
Thank you! Best regards, Luis
Hi,
Seems the download monitor doesn't take into consideration the publish date.
Let's say if we want the download only available on 2018-01-01, you can't. If you have the post URL you can download the file before the scheduled date.
So I added the following lines on line 287 of class-dlm-download-handler.php to tackle this issue:
$post_date = get_the_date( 'Y-m-d H:i:s', $download_id ); $current_time = current_time( 'Y-m-d H:i:s' ); if ( $post_date > $current_time ) { wp_die( __( 'Download does not exist.', 'download-monitor' ) . ' <a href="' . home_url() . '">' . __( 'Go to homepage →', 'download-monitor' ) . '</a>', __( 'Download Error', 'download-monitor' ), array( 'response' => 404 ) ); }
Maybe you can merge this piece of code into the next release?
Best regards, Luis