• Resolved rboatright

    (@rboatright)


    running download monitor 4.0.4

    We have, for a very long time, used versions so that we can have a title for a specific issue i.e. “Grantville Gazette Volume 75” and then versions for each file format such as RTF, HTML zip, epub, and mobi. So, we would have version slugs like “4-RTF” and “2-Epub”.

    This has worked, essentially forever, until a recent update.

    Now, using the plug-in’s own built in template for the download list, we get links for all the versions, but they all download the LAST version. The various versions are not downloadable. The /v=### or /version=2-epug doesn’t get added to the download link, and if I try to create the appropriate url manually i get them message “No file paths defined.”

    This is “bad”

    the call in the Gazette-downloads page is:

    Downloads:
    [downloads orderby=title order=DESC]

    which looks fine to me, and as I said, I’m using the provided template for the version list.

    it outputs

    • Grantville Gazette Volume 76
    • Version – 4: RTF
    • Version – 3: HTML
    • Version – 2: EPUB
    • Version – 1: MOBI
    • Grantville Gazette Volume 75

    • Version – 4: RTF
    • Version – 3: HTML
    • Version – 2: EPUB
    • Version – 1: MOBI

    in the case of Vol 76, all the links point to https://grantvillegazette.com/wp/download/grantville-gazette-volume-76/

    and in the case of 75, they all point to
    https://grantvillegazette.com/wp/download/grantville-gazette-volume-76/

    Here’s the code for the template from the plug-in’s content-download-version-list.php

    
    <?php
    /**
     * List of versions
     */
    
    if ( ! defined( 'ABSPATH' ) ) {
    	exit;
    } // Exit if accessed directly
    
    /**
     * Shows title.
     */
    
    /** @var DLM_Download $dlm_download */
    if ( $dlm_download->get_version()->has_version_number() ) {
    	$something = $dlm_download->get_version()->get_version_number() ;
    	echo $dlm_download->the_title();
    }
    
    $versions = $dlm_download->get_versions();
    
    if ( $versions ) : ?>
    	<ul class="download-versions">
    		<?php
    		/** @var DLM_Download_Version $version */
    		foreach ( $versions as $version ) { ?>
    			<li><a>get_download_count(), 'download-monitor' ), $dlm_download->get_download_count() ) ?>"
    			       href="<?php $dlm_download->the_download_link(); ?>" rel="nofollow" >
    					<?php if ( $version->has_version_number() ) {
                          	$thisVersion = strtoupper(str_replace(".",": ",$version->get_version_number()));                        
    						echo 'Version - ' . $thisVersion;
    					} ?>
    				</a></li>
    		<?php
    		}
    		?>
    	</ul>
    <?php endif; ?>'
    

    The page I need help with: [log in to see the link]

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter rboatright

    (@rboatright)

    So, I got the template code from github, and put it in instead

    I now get this:

    
    - 4.rtf
    H_Grantville_Gazette_Volume_76.zip - 3.html
    Grantville_Gazette_Volume_76.epub - 2.epub
    Grantville_Gazette_Volume_76.mobi - 1.mobi
    
    D_Grantville_Gazette_Volume_75.zip - 4.rtf
    H_Grantville_Gazette_Volume_75.zip - 3.html
    Grantville_Gazette_Volume_75.epub - 2.epub
    Grantville_Gazette_Volume_75.mobi - 1.mobi
    

    in the upper case, the url that all four link to is simply
    https://grantvillegazette.com/wp/download/grantville-gazette-volume-76/

    and in the second case…
    https://grantvillegazette.com/wp/download/grantville-gazette-volume-75/

    and again, if I even -try- to create the download of the specific version I get

    Download does not exist. Go to homepage →

    no matter what url I link to… /version=XXXXX or /v=####

    also, testing tells me that for each $version $version->get_download_id() always returns the id for the LATEST version, not the version in question… ooops

    Hello,

    It looks like the code you shared was not edited properly and causing issue here. Can you please let us know if you have customized our plugin templates or using the default once?

    Hello,
    I have the exact same issue.
    I’m not using any addon or custom template.

    But it’s clear in standard template code that all the versions has the same url. Basically, the plugin never knows how to distinct between versions based on the url.

    Here is the fix:

    Change the code at the standard template file in

    wp-content/plugins/download-monitor/templates/content-download-version-list.php

    or in your custom template, where it’s

    href="<?php $dlm_download->the_download_link(); ?>"

    to this:

    href="<?php $dlm_download->the_download_link(); ?>?version=<?php echo $version->get_version_number(); ?>"

    Then it works perfectly.

    • This reply was modified 8 years, 3 months ago by JAssist.
    Plugin Contributor Barry Kooij

    (@barrykooij)

    Thanks for letting us know. I’ll look into this and fix this.

    Plugin Contributor Barry Kooij

    (@barrykooij)

    This will be fixed in the upcoming update (4.0.6).

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Problem with downloading versions’ is closed to new replies.