Just to shine a bit more light on this – I just want the downloads to be freely accessible. I have added add_filter( 'dlm_do_not_force', '__return_true' ); to my functions file so the files open directly in the browser. But they all result in 404s unless I edit the htaccess file in the dlm_uploads folder to remove the deny from all directive….which feels wrong…
Hey @mrmocha,
I regret to say this falls under custom development and I would suggest contacting a 3rd party developer. Also, please note that the filter you used is useful when you are using the “Redirect to File” feature.
Ok. Thank you for getting back to me
I know this is marked as resolved but in case anyone finds this going forward you can change the upload location using the ‘upload_dir’ filter.
The following function is modified from the method used in the plugin to set the directory.
The value for $new_upload_directory sets the folder, if you want to use the WordPress default set this to an empty string.
function override_dl_upload_dir( $pathdata ) {
$new_upload_directory = '/new_upload_directory';
if ( isset( $_POST['type'] ) && 'dlm_download' === $_POST['type'] ) {
//if no subdirectory set add one
if ( empty( $pathdata['subdir'] ) ) {
$pathdata['path'] = $pathdata['path'] . $new_upload_directory;
$pathdata['url'] = $pathdata['url'] . $new_upload_directory;
$pathdata['subdir'] = $new_upload_directory;
} else {
//if subdirectory is set, replace '/dlm_uploads'
$new_subdir = $new_upload_directory . str_replace('/dlm_uploads', '', $pathdata['subdir'] );
$pathdata['path'] = str_replace( $pathdata['subdir'], $new_subdir, $pathdata['path'] );
$pathdata['url'] = str_replace( $pathdata['subdir'], $new_subdir, $pathdata['url'] );
$pathdata['subdir'] = str_replace( $pathdata['subdir'], $new_subdir, $pathdata['subdir'] );
}
}
return $pathdata;
}
add_filter('upload_dir', 'override_dl_upload_dir', 99);
Thanks a lot for sharing this @damonmaldonado. I hope this will help people!
Thank you for taking the time to reply @damonmaldonado. This looks very helpful 🙂