Page 1 of 1
Download Counter Plugin
Posted: Mon Nov 28, 2022 11:14 pm
by fraenkiman
Hello all,
I have dug out a
legacy plugin for you again and reworked it a bit. The plugin comes from
Igor Komin.
The plugin adds a BBCode "download" with a link to the file to download and a counter how many times the file was downloaded.
I have tested the plugin with Smarty 2.6 and 4.
If you are already using FlatPress 1.3dev with Smarty 4, you might have to replace a space in your own name with
This is not very user-friendly, but it works. Maybe someone can track down the cause and fix it.
Details and download can be found in
the wiki.
With best regards
Frank
Re: Download Counter Plugin
Posted: Tue Nov 29, 2022 12:00 am
by virtualsky
Hey, this is great! I'll definitely check it out. Thanks for putting this together.
Re: Download Counter Plugin
Posted: Wed Nov 30, 2022 3:48 am
by virtualsky
Frank, how would I go about changing the default directory that this plug-in references for the files to be downloaded? I'm trying something unique and I want to download files from a particular directory that isn't fp-content/attachs.
Re: Download Counter Plugin
Posted: Wed Nov 30, 2022 11:37 pm
by fraenkiman
Hello virtualsky,
you would have to change the path in both files.
In the
plugin.downloadctr.php file look for the line (~ line 63)
and replace it with
Code: Select all
$download = './your_directory/' . $file;
In the file
download.php look for the line (~ line 27)
Code: Select all
$download = '../../' . ATTACHS_DIR . $downloadFile;
and replace it with
Code: Select all
$download = './your_directory/' . $downloadFile;
To the "new" directory the web server user must also have write permissions.
With best regards
Frank
Re: Download Counter Plugin
Posted: Thu Dec 01, 2022 12:10 am
by virtualsky
Fantastic! Thanks, Frank.
Re: Download Counter Plugin
Posted: Sun Dec 11, 2022 1:25 pm
by Arvid
A little suggestion: The plugin crashes if the BBCode plugin is not activated. Solution is easy, just check for the existance of
plugin_bbcode_init():
Code: Select all
function plugin_bbcode_downloadctr_tag() {
if (!function_exists('plugin_bbcode_init')) {
return;
}
$bbcode = plugin_bbcode_init(); // import the "global" bbcode object into current function
All the best,
Arvid
Download Counter Plugin 1.3.2
Posted: Wed Dec 14, 2022 1:07 am
by fraenkiman
Hello Arvid,
also here many thanks for your hint and the solution
.
The fix for the plugin is ready and can be
downloaded from the wiki.
With best regards
Frank