Hi, i found this plugin doesn’t work with the external/remote file e.g. Google cloud or Google Drive.
Error code: 7
]]>Hello Jeff,
I love your plugin. One of your wishes is: “Supports all local and remote downloads”
However I cannot get the plugin to work together with cloud storage services like Google Drive, pCloud or Icedrive.
E.g. I created a Google-drive-file-sharing link for a pdf file: https://drive.google.com/file/d/1aAIq1N1MLG6Cm59TzfPTlQdbhlrPNfKc/view?usp=sharing
This link is “open” and it works for sharing (you can try it). However when I put this URL in the “Download URL” input box of the plugin, save it and use it’s permalink, it does not download the (pdf) file, but instead it downloads a “view” file, which basically is a html representation of the Google drive preview page.
The same holds for Cloud services like pCloud.com and icedrive.net. It seems this has to do with the fact that there is no direct download link available for these cloud services.
The following article suggests a solution for creating a direct downkload URL for Google drive, transforming the Google-drive-sharing-URL in:
https://drive.google.com/uc?id=1aAIq1N1MLG6Cm59TzfPTlQdbhlrPNfKc&export=download
However this URL gives an error after updating this URL: “File does not exist. Error code: 7”
The article also suggests to use the Google Drive Direct Link Generator: https://sites.google.com/site/gdocs2direct/ This creates the following output link: https://drive.google.com/uc?export=download&id=1aAIq1N1MLG6Cm59TzfPTlQdbhlrPNfKc
The last URL also gives the “File does not exist. Error code: 7” error after updating.
Is there a way to make the Simple Download Counter working with the file sharing option in Google Drive?
Thx in advance!
/// Henk
Hello,
Thanks you for your great plugin. i want to ask how to display file size type apk/app when downloading from remote file using your plugin. because the file size is unknown.
I use subdomain using storage like s3. if I don’t use your plugin the file size is visible when downloading
have tried editing and adding code in /inc/functions-core.php for Remote file headers but it doesn’t work. like header (‘Content-Length:’. filesize($file_path)); .can you help me? thank you.
]]>I have 2 WordPress websites.
1 is the main website and the other is for the resources for the main website.
I am trying to create a download counter on the main website for the files I have on the resources website but when I add the link to the file and try to publish the download counter it shows the error
“File does not exist. Error code: 7”
Is there a workaround on this or is this not possible?
Since the original thread is closed for new comments, a new reply here:
@specialk it seems to be showing up on admin pages that renders wp_editor(). I’m observing this behaviour on:
If it helps, there are other plugin(s) with a similar issue:
Here’s how you can replicate the issue:
Hope that helps.
]]>Hello,
The issue I have is the following
On my wordpress website , as soon as I click on the menu link “Downloads” to access plugin “Simple Download Counter”
My web site shuts down immediately
To sove the problem then I need to initiate the permalinks but just clicking on Save Permalinks without touching anything else.
I’m moving to this plugin from an old abandoned one and liking everything about it so far. Thanks for developing this!
Is there a way to output a HTML list <ul> of links from a particular download category? Or a HTML <select> menu? For example, to show the latest 5 downloads from the ‘newsletters’ category?
Any hooks I could use to create custom outputs myself?
Thanks.
]]>Hi Jeff, I’m back again. I have finally had time to give Cozmoslabs solution a try, but it hasn’t fixed the issue. I’m interested to know if you think this is a fix or have a solution. Here’s what they suggested. I followed these instructions. No luck. (I have a support request with Cozmoslabs.)
Instructions
You can remove that notification from Profile Builder WYSIWYG editor by using this mini-plugin.
The download counter will still work on your backend classical editor.
add_filter(‘mce_external_plugins’, ‘remove_simple_download_counter_add_mce_plugin’, 100); function remove_simple_download_counter_add_mce_plugin($plugins){ global $wppb_shortcode_on_front; if ( $wppb_shortcode_on_front ){ if (is_array($plugins) && isset($plugins[‘sdc_download’])){ unset($plugins[‘sdc_download’]); } } return $plugins; }
]]>I really like simple so this is great Thanks
But always a but LOL
I am not a great Tech
Is it possible within the shortcode to add the ability to display a download symbol you know it like a capital T upside down?
Thanks again will look to see if you do any others
G
]]>Hi, I’ve been getting “File does not exist. Error code: 7” when creating Download Link under ‘Add New Download’. My download URL links from Google Drive and Storj definitely works when I paste them onto my browser.
I’ve saved the permalinks page a few times but still getting this error.
Thanks.
]]>I’m using Permalink Manager to manage all my page url structure (for compatibility with old website), however no matter what I do I get a 404 on the download links (tried this sticky no difference).
When the code gets to the function simple_download_counter_download_handler the $_GET request only contains the query param “key” and nothing else.
I can fix it by also checking the REQUEST URI to grab the parameter needed… thoughts?
if (isset($_GET[$key]) && !empty($_GET[$key])) {
$wp->query_vars[$key] = sanitize_key($_GET[$key]);
} else {
$uri_segments = explode('/', parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH));
if ((count($uri_segments) > 3) && ($uri_segments[1] == $key)) {
$wp->query_vars[$key] = sanitize_key($uri_segments[2]);
}
}
]]>
Hi Jeff.
I spotted a weird error just now – WP backend, working on the GiveWP plugin, an error message breaks onto screen that seems to come from your plugin? >
<div id="mceu_62" class="mce-widget mce-notification mce-notification-error mce-has-close mce-in"...
Failed to initialize plugin: sdc_download
Browser console error below >
tinymce.min.js?ver=49110-20201110:2 Failed to initialize plugin: sdc_download ReferenceError: download_counter is not defined
at t.<computed>.t.<computed>.init (tinymce.js?wp-mce-49110-20201110:14:13)
at Ew (tinymce.min.js?ver=49110-20201110:2:330514)
at Array.<anonymous> (tinymce.min.js?ver=49110-20201110:2:332223)
at Object.jt [as each] (tinymce.min.js?ver=49110-20201110:2:29356)
at Aw (tinymce.min.js?ver=49110-20201110:2:332173)
at tN.<anonymous> (tinymce.min.js?ver=49110-20201110:2:333551)
at Array.<anonymous> (tinymce.min.js?ver=49110-20201110:2:96969)
at jt (tinymce.min.js?ver=49110-20201110:2:29356)
at u (tinymce.min.js?ver=49110-20201110:2:96914)
at n (tinymce.min.js?ver=49110-20201110:2:96402)
Thanks, and keep up the great work. ??
]]>The number of previous clicks is displayed, and recently, after clicking on the download link, the counter is not added
]]>I am using Cozmoslabs for member management and I was happy to find the sdc plug-in to show downloads for our journal articles. It’s working great; however, now members are getting this error on the profile page and can’t update or create profiles.
Failed to initialize plugin: sdc_download
Can you suggest anything?
Thanks, Cheryl
]]>How do you feel about requests for hooks? I think I could use one to try to gracefully handle old download links from our previous plugin that did not require hashes.
We have sent out a number of download links in things like email newsletters over the years. Some of them were intended to be able to be reused for future reference. I would like to find a better way to treat our visitors who might click those links than serve them a wp_die() message for clicking a link we ourselves sent them.
If it is no trouble, I would like to get some kind of hook where I could handle those old cases. I have done some experimenting, and here is an example hook would allows some flexibility:
$hash_key = apply_filters('simple_download_counter_download_hash', $hash_key, $id, $hash);
That would go right after $hash_key
is defined in inc/functions-core.php
, line 282. Then we could do things like these (I have tested both options):
$id
is in the range of the known old downloads and a key
url parameter is not set.If a person wanted to disable requiring hashes entirely, it could also work for that.
Totally unrelated: I just realized you are the person responsible for the 7G Firewall rules that I have been running on our sites for the last few years. Now I am doubly grateful, and you have my respect.
]]>I’m still working through my migration plan from the previous bloated plugin to your nice solution, and I found an issue with large download files. I have one file that is about 215MB. (Because of the file size, it had to be manually uploaded via FTP.)
I am able to get that file set up as a download in Simple Download Counter, but when a user clicks on it, the downloaded file has the correct name but is empty, and in the PHP error log, there is this error:
PHP Fatal error: Allowed memory size of 209715200 bytes exhausted (tried to allocate 169885696 bytes) in /local/path/mydomain.test/wp-content/plugins/simple-download-counter/inc/functions-core.php on line 387
I also get this error at line 342, which makes sense, because I tried to do this both as a local and a remote download with the same trouble each time.
The only idea I have for files such as this is simply to link directly to the resource without going through Simple Download Counter. Do you have another solution of something to do on my end?
Or perhaps there is some improvement that could be made to the plugin? I don’t know if this is any real help, but I looked up the PHP docs for the readfile()
function used at the two lines where I had the error, and I found this note that may be a clue:
readfile()?will not present any memory issues, even when sending large files, on its own. If you encounter an out of memory error ensure that output buffering is off with?ob_get_level().
https://www.php.net/manual/en/function.readfile.php
I followed the suggestion to test with ob_get_level()
to see if there is any output buffering, and it returned 2
. So just as a test I threw in a quick while (ob_get_level()) ob_end_clean();
just above the readfile()
and tried again. Then the large download seemed to work exactly as I hoped.
Of course, I don’t presume to know what implications that might have for the rest of your code, but I hope it might be a good start, and maybe it is a good memory optimization even for files that can otherwise fit in allocated memory, because it apparently is reading in the whole file to memory before sending out headers.
(Note: at present this is only on a local dev site. Using current WordPress 6.3.2 and Simple Download Counter 1.7)
]]>Hello,
i saw that previous conversation is not anymore visible on the old topic because it’s resolved. We have a client WP 5.9 with PHP 7.1 (due to client restriction on his server, and when we install the plugin we have this issue (i don’t know how to share with you the sceen capture).
Can you help us on that issue ?
]]>Is this vulnerability is fixed ?
more of that, i don’t find the information about what is the php version minimum needed to run your plugin ?
]]>I was very excited to find your plugin after I had enough with another plugin gaining even more bloat and requiring me to make some further compatibility changes on our site for the latest update to said plugin. Thank you for making your solution available.
While I was going through testing all the changes we made to move over to your plugin, I discovered that page caching was disabled everywhere on frontend regardless of whether a download was involved. I tracked it down to the following line from inc/functions.core:244
if (!defined('DONOTCACHEPAGE')) define('DONOTCACHEPAGE', true);
In testing, I found setting the constant to false or removing the line resolved the caching problem.
Since your function simple_download_counter_download_handler()
runs on every frontend page and even some admin pages, I recommend trying to find a better way to define the constant only when a download is requested. For example, I tried moving the line inside of the if statement at line 268, and all seems well, though I am sure you could come up with something better since you know your own code.
Thank you for considering this issue.
In case you need to know, I am using the WP Rocket plugin for our page caching, and they do respect the DONOTCACHEPAGE constant (source: https://docs.wp-rocket.me/article/141-force-page-caching).
]]>Is there a way to turn off the tooltip that shows the number of downloads as we wouldn’t want that information to be public.
]]>Hi,
My download count increases by 5 or 3 for a single download that contains multiple pages. what could be the issues.
]]>I’m having problem with this.
Parse error: syntax error, unexpected ‘)’ in simple-download-counter/inc/settings-display.php on line 18
Please help me. Thanks!
]]>Installing SDC and Bricks Builder Latest (1.8.1) on a clean latest WordPress install causes a critical error with Bricks Builder the error comes from Bricks when trying to edit the template
Video of setup etc is here: https://s.foley.me.uk/xQuEWeq4
Error Code by debug below
Fatal error: Uncaught Error: Call to undefined function simple_download_counter_get_current_screen_pt() in /home/mulilagoku7313/web/r-in-space-zenu.instawp.xyz/public_html/wp-content/plugins/simple-download-counter/inc/functions-admin.php:213 Stack trace: #0 /home/mulilagoku7313/web/r-in-space-zenu.instawp.xyz/public_html/wp-includes/class-wp-hook.php(310): simple_download_counter_editor_height() #1 /home/mulilagoku7313/web/r-in-space-zenu.instawp.xyz/public_html/wp-includes/plugin.php(205): WP_Hook->apply_filters() #2 /home/mulilagoku7313/web/r-in-space-zenu.instawp.xyz/public_html/wp-includes/class-wp-editor.php(807): apply_filters() #3 /home/mulilagoku7313/web/r-in-space-zenu.instawp.xyz/public_html/wp-includes/class-wp-editor.php(308): _WP_Editors::editor_settings() #4 /home/mulilagoku7313/web/r-in-space-zenu.instawp.xyz/public_html/wp-includes/general-template.php(3821): _WP_Editors::editor() #5 /home/mulilagoku7313/web/r-in-space-zenu.instawp.xyz/public_html/wp-content/themes/bricks/includes/builder.php(699): wp_editor() #6 /home/mulilagoku7313/web/r-in-space-zenu.instawp.xyz/public_html/wp-content/themes/bricks/includes/builder.php(345): Bricks\Builder->get_wp_editor() #7 /home/mulilagoku7313/web/r-in-space-zenu.instawp.xyz/public_html/wp-includes/class-wp-hook.php(308): Bricks\Builder->enqueue_scripts() #8 /home/mulilagoku7313/web/r-in-space-zenu.instawp.xyz/public_html/wp-includes/class-wp-hook.php(332): WP_Hook->apply_filters() #9 /home/mulilagoku7313/web/r-in-space-zenu.instawp.xyz/public_html/wp-includes/plugin.php(517): WP_Hook->do_action() #10 /home/mulilagoku7313/web/r-in-space-zenu.instawp.xyz/public_html/wp-includes/script-loader.php(2194): do_action() #11 /home/mulilagoku7313/web/r-in-space-zenu.instawp.xyz/public_html/wp-includes/class-wp-hook.php(308): wp_enqueue_scripts() #12 /home/mulilagoku7313/web/r-in-space-zenu.instawp.xyz/public_html/wp-includes/class-wp-hook.php(332): WP_Hook->apply_filters() #13 /home/mulilagoku7313/web/r-in-space-zenu.instawp.xyz/public_html/wp-includes/plugin.php(517): WP_Hook->do_action() #14 /home/mulilagoku7313/web/r-in-space-zenu.instawp.xyz/public_html/wp-includes/general-template.php(3049): do_action() #15 /home/mulilagoku7313/web/r-in-space-zenu.instawp.xyz/public_html/wp-content/themes/bricks/header.php(7): wp_head() #16 /home/mulilagoku7313/web/r-in-space-zenu.instawp.xyz/public_html/wp-includes/template.php(783): require_once('...') #17 /home/mulilagoku7313/web/r-in-space-zenu.instawp.xyz/public_html/wp-includes/template.php(718): load_template() #18 /home/mulilagoku7313/web/r-in-space-zenu.instawp.xyz/public_html/wp-includes/general-template.php(48): locate_template() #19 /home/mulilagoku7313/web/r-in-space-zenu.instawp.xyz/public_html/wp-content/themes/bricks/template-parts/builder.php(2): get_header() #20 /home/mulilagoku7313/web/r-in-space-zenu.instawp.xyz/public_html/wp-includes/template-loader.php(106): include('...') #21 /home/mulilagoku7313/web/r-in-space-zenu.instawp.xyz/public_html/wp-blog-header.php(19): require_once('...') #22 /home/mulilagoku7313/web/r-in-space-zenu.instawp.xyz/public_html/index.php(17): require('...') #23 {main} thrown in /home/mulilagoku7313/web/r-in-space-zenu.instawp.xyz/public_html/wp-content/plugins/simple-download-counter/inc/functions-admin.php on line 213
I will open a ticket with Bricks Builder too
]]>Hi,
I am using SDM on my WordPress Multisite. I have around 82 sub-sites and all the them has SDM enabled and has around 1000 posts. It was working fine till now but suddenly when we click on the “PDF” button i.e. for downloading media which has the sdc_download Permalink, it downloads the file of 0 bytes and it shows error when opening that file. But that same file, if downloaded using media upload url, it is downloading perfectly. I have disabled all plugin to check for conflict but the issue remains. I have deactivated and reactivated but the issue is still there. Then I have tried going to permalink and saving it without making any change, still no luck. Could you please help. This is sort of a serious issue and is affecting thousands of file on my multisite network.
]]>Hi. I am getting this PHP warning in the query monitor.
https://www.dropbox.com/s/1jl80ixnum2g459/download-counter-php-error.png?dl=0
The error shows up no matter whether I have my caching plugin activated or not. I am using cache enabler.
]]>Getting the following errors on a fresh install.
[03-Apr-2023 21:49:14 UTC] PHP Fatal error: Uncaught Error: Call to undefined function simple_download_counter_get_current_screen_pt() in /public_html/wp-content/plugins/simple-download-counter/inc/functions-admin.php:8
Stack trace:
0 /public_html/wp-includes/class-wp-hook.php(308): simple_download_counter_settings_flush_rewrite(Object(WP_Screen))
1 /public_html/wp-includes/class-wp-hook.php(332): WP_Hook->apply_filters('', Array)
2 /public_html/wp-includes/plugin.php(517): WP_Hook->do_action(Array)
3 /public_html/wp-admin/includes/class-wp-screen.php(424): do_action('current_screen', Object(WP_Screen))
4 /public_html/wp-admin/includes/screen.php(243): WP_Screen->set_current_screen()
5 /public_html/wp-content/plugins/jetpack/jetpack_vendor/automattic/jetpack-sync/src/class-sender.php(505): set_current_screen('sync')
6 /public_html/wp-content/plugins/jetpack/jetpack_vendor/automattic/jetpack-sync/src/class-sender.php(601): Automattic\Jetpack\Sync\Sender->get_items_to_send(Object(Automattic\Jetpack\Sync\Queue_Buffer), true)
7 /public_html/wp-content/plugins/jetpack/jetpack_vendor/automattic/jetpack-sync/src/class-sender.php(462): Automattic\Jetpack\Sync\Sender->do_sync_for_queue(Object(Automattic\Jetpack\Sync\Queue))
8 /public_html/wp-content/plugins/jetpack/jetpack_vendor/automattic/jetpack-sync/src/class-sender.php(404): Automattic\Jetpack\Sync\Sender->do_sync_and_set_delays(Object(Automattic\Jetpack\Sync\Queue))
9 /public_html/wp-content/plugins/jetpack/jetpack_vendor/automattic/jetpack-sync/src/class-actions.php(191): Automattic\Jetpack\Sync\Sender->do_dedicated_sync_and_exit()
10 /public_html/wp-includes/class-wp-hook.php(308): Automattic\Jetpack\Sync\Actions::add_dedicated_sync_sender_init('')
11 /public_html/wp-includes/class-wp-hook.php(332): WP_Hook->apply_filters(NULL, Array)
12 /public_html/wp-includes/plugin.php(517): WP_Hook->do_action(Array)
13 /public_html/wp-settings.php(623): do_action('init')
14 /public_html/wp-config.php(95): require_once('/…')
15 /public_html/wp-load.php(50): require_once('/…')
16 /public_html/wp-blog-header.php(13): require_once('/…')
17 /public_html/index.php(17): require('/…')
18 {main}
thrown in /public_html/wp-content/plugins/simple-download-counter/inc/functions-admin.php on line 8
]]>
Hello, I keep getting this email (daily) from WordPress that the plugin has caused an error. The odd thing is it isn’t occurring on an actual page, but on the wp-cron.php page (/wp-cron.php?doing_wp_cron=1680507230.2868020534515380859375). Our website seems to be working just fine and the plugin is also working. Any ideas on how to fix this problem and stop the error messages? Thanks
Error Details
=============
An error of type E_ERROR was caused in line 8 of the file /home/USER/public_html/wp-content/plugins/simple-download-counter/inc/functions-admin.php. Error message: Uncaught Error: Call to undefined function simple_download_counter_get_current_screen_pt() in /home/USER/public_html/wp-content/plugins/simple-download-counter/inc/functions-admin.php:8
Stack trace:
#0 /home/USER/public_html/wp-includes/class-wp-hook.php(308): simple_download_counter_settings_flush_rewrite(Object(WP_Screen))
#1 /home/USER/public_html/wp-includes/class-wp-hook.php(332): WP_Hook->apply_filters(NULL, Array)
#2 /home/USER/public_html/wp-includes/plugin.php(517): WP_Hook->do_action(Array)
#3 /home/USER/public_html/wp-admin/includes/class-wp-screen.php(424): do_action('current_screen', Object(WP_Screen))
#4 /home/USER/public_html/wp-admin/includes/screen.php(243): WP_Screen->set_current_screen()
#5 /home/USER/public_html/wp-content/plugins/jetpack/jetpack_vendor/automattic/jetpack-sync/src/class-sender.php(505): set_current_screen('sync')
#6 /home/USER/public_html/wp-content/plugins/jetpack/jetpack_vendor/automattic/jetpack-sync/src/class-sender.php(601): Automattic\
]]>
Hi Jeff,
I am using SDC Plugin with a shortcode [sdc_count id=”34928″]. It should display a count of the downloads. However, the output is in this format
[Download Post Name -12 Downloads]
I just want the number 12. I do not want the Downloads at the end or the Download Post Name at the beginning.
I can even manage with “12 Downloads” but the before that the post name starts showing which are long names and I do not want to show that. If I wanted to output the file name I would have gone with the other variation of the shortcode.
I there a way I can stop this from showing? Please help.
]]>I created the download with url to a PDF. I posted the shortcode. If the user clicks the link the PDF download opens, is it possible to open the PDF in a new TAB instead?
]]>This plugin is exactly what I was looking for, thank you! The old download manager I had finally doesn’t work with WordPress anymore and so I’m having to start over again.
Two features that I’d like to see in future updates though. First one is that my one site has hundreds of downloads and they’re all in the same directory. It’s a bit of a pain to have to enter httpscolonslashslashmysubdomain.mysite.com/folder/anotherdirectorywhatever/filenameblahblah.zip every single time. I was hoping that you could maybe implement a selection to use a base url and then just enter the filename for each download?
The other feature I’d like to see eventually is a widget that would display the top ten most popular (or the most downloaded) files. I could probably make one myself but first I have to do all that copy and pasting! ??
]]>