• Resolved danbrellis

    (@danbrellis)


    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/

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter danbrellis

    (@danbrellis)

    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!

    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?

    Thread Starter danbrellis

    (@danbrellis)

    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.

    Thread Starter danbrellis

    (@danbrellis)

    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';
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Support for Website Downloads’ is closed to new replies.