WordPress.org

Ready to get started?Download WordPress

Forums

Download Monitor
[resolved] Support for Website Downloads (5 posts)

  1. danbrellis
    Member
    Posted 1 year ago #

    This is a great plugin and am supper appreciative of the new version.

    I wanted to make a feature request (or find out if this already exists) on how to allow websites to be added as downloads. Currently, the plugin adds the website no problem in the add download (backend) page under versions. However, functions, like get_the_download_link() and get_the_filetype() seem to break on such downloads.

    Thoughts?

    http://wordpress.org/extend/plugins/download-monitor/

  2. danbrellis
    Member
    Posted 1 year ago #

    My current work around:

    add_filter('dlm_do_not_force','hgs_dlm_do_not_force',10,3);
    function hgs_dlm_do_not_force($bool, $download, $version){
    	$bool = true;
    	return $bool;
    }

    This disables the force download, so webpages are opened in a new window. Fortunately, the plugin author was kind enough to include the download and version in the filter, so you could condition to force or not based on the if the download was a webpage.

    As for the filetype, this is working for me for now:

    echo $dlm_download->get_the_filetype() ? $dlm_download->get_the_filetype() : 'web';

    I am still curious on your thoughts about adding a web filetype for a version if it's a webpage into the database, rather than conditioning. Or, to include a condition in the get_the_filetype() function.

    Thanks!

  3. Interpolat
    Member
    Posted 1 year ago #

    Thanks for this work-around, as this is a feature I need as well. So where do you place the code echo $dlm_download->get_the_filetype() ? $dlm_download->get_the_filetype() : 'web';

    Is that going in the functions.php file as well?

  4. danbrellis
    Member
    Posted 1 year ago #

    No problem, glad it helped out someone as well.

    Unfortunately, there is no filter for the get_the_filetype() function, so where ever I need the filetype to be displayed, I replace $dlm_download->the_filetype() with that code snippet. So for instance, in your download template in the plugin folder (i.e. templates/content-download.php). Hope this helps.

  5. danbrellis
    Member
    Posted 1 year ago #

    Actually, I just noticed that is a top-level domain is entered (i.e. http://foo.net/), the plugin will take "net" as the file extension, so whenever I output a file extension on my site, I check for web extensions first:

    $webext = array('net','com','org','edu','gov','mil','info','biz');
    echo $dlm->get_the_filetype() && !in_array($dlm->get_the_filetype(), $webext) ? $dlm->get_the_filetype() : 'web';

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic