You rock Joe. Thanks for posting this information. It helped save some serious time today.
I made this change and now my pages and posts aren’t broken. But, the download links that used to work now show a permissions error.
Forbidden
You don't have permission to access /wp-content/uploads/dlm_uploads/2015/08/[filename] on this server.
Example:
https://www.thunderheadeng.com/wp-content/uploads/dlm_uploads/2015/08/hrr_calculator.xlsm
@jeff thx ๐
@bklein which template did you modify? And could you maybe share the link to the post as well?
I modified the file ‘content-download.php’ in my theme directory. The content of the file is below.
<?php
/**
* Default output for a download via the [download] shortcode
*/
/*global $dlm_download;*/
?>
<a class="download-link" title="<?php $dlm_download->the_filename(); ?> – <?php $dlm_download->the_filesize(); ?>" href="<?php $dlm_download->the_download_link(); ?>" rel="nofollow"><?php $dlm_download->the_title(); ?></a>
<?php if ( $dlm_download->get_the_short_description() ) {
$shortDescription = strip_tags($dlm_download->get_the_short_description());
$downloadID = $dlm_download->id;
echo "<a href='#' id='moreLink_".$downloadID."' class='moreLink'><small>[See Description]</small></a>
<span id='description_".$downloadID."' class='moreinfo'><a href='#' id='lessLink_".$downloadID."' class='lessLink'><small>[Hide Description]</small></a> - ".$shortDescription."<br><br></span>";
}
?>
Here is a link to a page with the new permissions issue. http://www.thunderheadeng.com/pyrosim/resources/
Click on the text under any of ‘Tools’, like ‘Heat Release Rate Calculator’ or ‘Combustion Calculator’.
Well, the code looks ok so far – there isn’t even any permission check or similar. I assume you’re sure that it did work before the latest update? I really don’t see how that fix above could cause that issue you experience. :/
It did work before the Download Monitor update that I applied this morning.
This is a link to an image of the permissions set for files that are not working. It seems ok to me, but maybe I am missing something.
https://drive.google.com/file/d/0BwyS63UB7wW4UndBS1BObktHZlk/view?usp=sharing
Ok, this is weird, there was a .htaccess file in the dlm_uploads directory that had ‘deny from all’ in it. When I removed that text and saved the file, my download links work again. What the heck happened?
I also have this file in the same folder with the same content, but my downloads are working. Well – really weird. However, glad that everything works for you now ๐
Joe! Thank you. Saved me!
Joe, I assumed that it was there to block direct access and that the Download Manager would serve the file from the folder that was hidden from a direct read from the file system.
Maybe this feature is broken, or I have some kind of setting messed up.
Thanks so much for point this out Joe, and sorry to anyone running into issues because of this.
We’ve removed the global $dlm_download support from our templates files July last year but indeed removed a globalization from the shortcode wrapper in 1.9.2.
Because we haven’t been using the global ourselves for so long I removed it so easily from the shortcode wrapper, not realizing people might still have it in their own template files.
I’m sorry about this, in retroperspective I should have communicated this better in the changelog. Luckily the fix for this is easy, simply remove the global $dlm_download; from the top of your template files.
@bklein I suspect you had 2 issues that are not directly related to each other after last update. From what I understand you’ve fixed the global issue already but are still having a permission issue. Regarding the .htaccess file, we place this in the dlm_uploads folder to prevent direct access to your files from users. If you’re using the ‘Redirect to file’ option, you should remove the .htaccess file or move the files to a different folder. If you still have questions regarding permissions please create a new topic here so we can keep this thread focused on the global issue.
Thanks again for spotting this so quickly Joe.
Kind Regards,
Barry Kooij
Thank you Barry,
I will make a new thread as I still have some questions about this feature.
Best Regards,
-Bryan
Edit:
Found the solution. I hade to go to the Editor for my theme via the Admin page. No need to answer this question. Thanks anyway!
****
Could someone please explain this:
“just open up your custom download templates from within your theme (something like content-download-[slug].php) and remove the global $dlm_download”
Should I look inside my theme folder for the php file? What if I cannot find such a file?
In my case I cannot find a php file named “content-download-[slug].php in my theme folder at:
/[domain]/public_html/wp-content/themes/responsive
The name of my theme is “Responsive” by Cyberchimp:
https://wordpress.org/themes/responsive/
Kind regards
// Pรคr