This plugin allows you to limit the number of uploads for your users. You can choose a total number of files, or a certain amount of files for different periods of time.
Download: http://sourceforge.net/projects/coppermine/files/Plugins/1.5.x/cpg1.5.x_plugin_limit_upload_v1.0.zip/download
Thanks for the plugin. I just tried and it doesn't looks to work right.
I login like admin, and activated the plugin, and uploads a couple of pictures ( I guess that the restrictions doesn't affect the admin, which is cool). Then I log out and I log in with the test user, and I get the message that I already have reach the maximum of files. I get back to the admin and put a bigger number, and get back to the test user and tried again, with the same result.
I saw a interesting thing when I was saving the data like an admin, it's look like when you saving the maximum number, it doesn't matter which option did you select (total, day, month, year). It's always saving the total one.
If you need to check it out here:
http://focofijo2.webcindario.com/Galeria/
test user: red
test pass: nono
I saved 2 per 24 hours.... but, when I checked back in the configuration said 2 total.
The error message says
QuoteYou've reached the upload limit of 2 files .
but it has to say something like
QuoteYou've reached the upload limit of 2 files total/per hour/per day/etc.
so I assume one value isn't stored in the config. I'll check that.
I renamed a language string and forgot to rename it in the code ::) Please try version 0.2 attached to initial post.
Something is not working.
The drop menu is working now, and it save the configuration that you put it on. But, I just try with 4 pictures in 24h, and when I logged in with the test user, I get this message:
"Error
You've reached the upload limit of 4 files per day (24 hours).
You have to wait 144 hour(s) before uploading another file. "
The last file that the test user upload was July 1, and... the hours that you have to wait can't be right. ::)
I made a new user
user:test
pass: test1
And I upload 4 new photos without problem, then I tried to upload the 5 one and I got:
"Error
You've reached the upload limit of 4 files per day (24 hours).
You have to wait 1 hour(s) before uploading another file. "
Should be fixed in version 0.3 (attached to initial post).
I just tried and isn't working now.
I logged in like the admin, set the plugin, set the limit to 1 per 24 hours, logged out, and logged in like the test user, upload a pictures without problem... and then another one.. and another one. I also tried with different setting like 1 total, or 1 per hours, with the same result.
By the way, I did translate to Spanish.
Thanks for your contribution. It has been added to version 0.4. I also fixed the issue (I forgot to remove my debug stuff ::)). Please try again version 0.4 (attached to initial post).
Works great. Thank you!! ;D
Hi André,
I would love if you can add one more thing to this plugin.
Another factor to control the upload could be, that you can't upload anything until you make a X comment (in the last 24 hours) to other user's pictures.
In that way, if we set the number on two, you will need to write two comments in other pictures everyday in order to upload a picture.
And it will be great if we can combine the two different options, and be able to get a result like this:
You need to write 2 comments in other user's pictures (in the last 24 hours), in order to upload a picture, to the maximum of 2 upload pictures every 24 hours.
And you maybe asking yourself "Why?" I believe that in order for some users to participate and help to other users, sometimes you must have then to do it, or at the end they are going to forget about other users and only upload theirs pictures and wait for everyone to comment theirs.
Thank you!!
very nice plugin! thx!
would be really cool if you could change the limits per usergroup :)
ok fixed that for my vbulletin bridge . perhaps someone needs it
1. I edited the codebase.php and removed the switch($CONFIG['limit_upload_time_limit'])
2. getting the usergroupid from my vbulletin table
$usergroupid = mysql_result(cpg_db_query("SELECT usergroupid FROM user WHERE userid = ".USER_ID), 0);
3. build a new switch based on the $usergroupid
switch($usergroupid) {
case '6':
$multiplicator = 24;
break;
case '7':
$multiplicator = 1;
break;
default: $multiplicator = false; break;
}
now I have different timelimits for my usergroups
Can't edit the post above. Hope I am not spamming :(
so here is my complete solution
// get the vbulletinusergroupid for that user
$usergroupid = mysql_result(cpg_db_query("SELECT usergroupid FROM user WHERE userid = ".USER_ID), 0);
switch($usergroupid) {
case 2:
$multiplicator = 24; // Time
$uploadlimit = 1; // Uploadlimit for this usergroup
break;
case 6:
$multiplicator = 24;
$uploadlimit = 2;
break;
case 5:
case 6:
case 7:
$multiplicator = 1;
$uploadlimit = 2;
break;
default: $multiplicator = false; break;
}
every usergroup has a different timemultiplicator and a different uploadlimit
and I had to change
if ($count >= $CONFIG['limit_upload_upload_limit']) {
to my new $uploadlimit:
if ($count >= $uploadlimit) {
and the errormessage for the user
from
$error = sprintf($lang_plugin_limit_upload['limit_reached_x'], $CONFIG['limit_upload_upload_limit'], $lang_plugin_limit_upload['upload_limit_values'][$CONFIG['limit_upload_time_limit']]);
to the new uploadlimit
$error = sprintf($lang_plugin_limit_upload['limit_reached_x'], $uploadlimit, $lang_plugin_limit_upload['upload_limit_values'][$CONFIG['limit_upload_time_limit']]);
it's not a good clean solution, because the values shouldn't be hardcoded, but it works for now :)
russian
Quote from: MISHA on January 04, 2011, 01:18:56 PM
russian
Added in svn revision 8167. Thanks for your contribution.
Hi I installed upload limit 0.4 set to 3 photos for 7 days. When, however, exceed the limit I can not even add comments to photos: (
writes me: You've reached the upload limit of 3 files per week (7 days).
Is not possible to eliminate this problem somehow?
Quote from: radog on March 02, 2011, 06:59:48 PM
When, however, exceed the limit I can not even add comments to photos
Open
codebase.php, find
if (!GALLERY_ADMIN_MODE && $CONFIG['limit_upload_upload_limit'] >= 0) {
and replace with
$superCage = Inspekt::makeSuperCage();
if ($matches = $superCage->post->getMatched('event', '/^[a-z_]+$/')) {
$event = $matches[0];
} elseif ($matches = $superCage->get->getMatched('event', '/^[a-z_]+$/')) {
$event = $matches[0];
} else {
$event = '';
}
$allowed_events = array('comment_update', 'comment', 'album_update', 'album_reset');
if (!GALLERY_ADMIN_MODE && $CONFIG['limit_upload_upload_limit'] >= 0 && !in_array($event, $allowed_events)) {
Please confirm if that works, then I'll release a new version.
Yes thank you it works without any problems .. Thank you again for your time :)
This is a great script but I need to change it to 1 upload every 3 days or 72 hours.
How would I go about modifying this please?
I have no knowledge of PHP but eager to learn as I am good with JavaScript and C# and Java.
Thanks.
I haven't tested that, but it should work if you set the multiplier
switch($CONFIG['limit_upload_time_limit']) {
// TODO: determine beginning of current hour/day/week/month/year and adjust the calculation
case 'total': $multiplicator = -1; break;
case 'hour': $multiplicator = 1; break;
case 'day': $multiplicator = 24; break;
case 'week': $multiplicator = 7*24; break;
case 'month': $multiplicator = 30*24; break;
case 'year': $multiplicator = 365*24; break;
default: $multiplicator = false; break;
}
to 3*24 or 72:
$multiplicator = 3*24;
in codebase.php.
ok! I have modified and installed the plugin.
Now I have to wait 3 days to see if it is working.
Cannot happen sooner as I need to test it against the time period.
Thanks.
I think there is a problem.
The plugin adds the uploads to the comments made by the same user.
So if the max upload is set at 4 per day and the user has two comments, he can only send two photos that day (24 hours)
Sorry for my bad English but I think you will understand what i say
Here is the portuguese lang for the plugin
Portuguese language file has been added in svn revision 8203. Thanks for your contribution.
The problem i reported is solved. Was my fault. Sorry guys.
Well here I am again. And I´m very sorry. Please excuse me my friend André.
Thats the story:
First of all I instaled the plugin and asked users to test. They report a problem between number of files uploaded and comments, so that was the reason of my first topic reply.
Then I tryed miself and all was fine for me. Then my second reply saying that problem was solved. I forgot I had administrator premissions. :-[ Sorry fellows !!
But the reports from users continue and i tryed it myself again, now without administrator power.
This is what I did:
1 - I made a lot of comments in user's pics without any problem.
2 - Then I uploaded my own files till the limit (till I received the error message: You\'ve reached the upload limit...)
3 - After this I tried to comment another pic and I received the same error message again (You\'ve reached the upload limit...) and I couldn't make more comments.
Can anybody try the same way i did ?
Try that solution: http://forum.coppermine-gallery.net/index.php/topic,65868.msg346746.html#msg346746
Thanks André.
Do you mean I must use the plugin and the mod at same time ?
WOW
Sorry again André
I made the mod in codebase.php.
I'll give feedback later. Thanks once more
Version 1.0 (attached to initial post) contains the suggested fix.
Hello everybody.
In attachment the italian translation for this very useful plugin.
I'd like to use it to manage an on-line contest with 2 themes: I created 2 public galleries - one per each theme - and I need to limit the upload to 4 images per each gallery.
How/where to modify this plugi to obtain it?
Thanks in advance, any help is appreciated.
Quote from: NoDigital on March 19, 2012, 01:05:39 AM
In attachment the italian translation for this very useful plugin.
Thank you for your contribution. Added Italian language file (with some fixes) in SVN revision 8341.
Quote from: NoDigital on March 19, 2012, 01:05:39 AM
I need to limit the upload to 4 images per each gallery.
How/where to modify this plugi to obtain it?
You don't need to modify the plugin, just set it accordingly in the plugin config.
I am using this to limit my members to 5 images a day. I have not really had admins tell me they can not do more than 5 a day since I am the only one to do so thus far--via ftp
But is there a way to either make a group in SMF (bridged) that will allow the member of that group to not be limited or in gallery to have the group not be limited.
It would be only that member that uploads images of our winners which are more than 5 and her own images also.
I will ask at SMF also about the "special" group.
well got word from SMF that there is no way to make an admin clone group so, Is there anyway to adjust the modification (plugin in) to disallow the global admins group or a different specific group?
Quote from: heavensportal on March 02, 2014, 03:40:29 AM
It would be only that member that uploads images of our winners which are more than 5 and her own images also.
If it's only one (or a few) users, you could also add a simple check like
if (USER_ID == 123) return;
to the top of the function
limit_upload_page_start in
codebase.php. This way you don't need to add those user(s) to a separate group, as you just check the user ID.
thank you so very much with your help to these little things I ask for.
Will give it a try and hope I put it in the right spot.
ok I did as you said--providing I put it in the right spot
this is the code as it appears in that file:
if (defined('DB_INPUT_PHP')) {
$thisplugin->add_action('page_start', 'limit_upload_page_start') ;
if (USER_ID == 1080) return;
}
Unfortunately that's the wrong place. Please undo your last change, instead search for
function limit_upload_page_start() {
and add the code below that line.
Hi.
I have some question about this plugin. Is it possible to apply the limit only for some galleries? My situation looks (or will look, I'm testing cpg on my local computer :) ) like this: there are some categories like Nature, Portrait available for all users, and I would like to limit the file numbers added in preiod of time to this categories. Every user has his personal gallery and could have possibility to add more pictures at once without waiting. But on the other hand I would like to limit all personal galleries to, for example, 40 pictures. Is it possible with your plugin?
As a small "gift" polish version :)
It's probably possible, but I've currently no spare time to investigate that further or create the corresponding code.
Thank you for your contribution, I'll add it as soon as possible.
I use this plugin on my 1.5.x gallery, and really need it now I'm about to upgrade to 1.6.x anyone know if it's compatible with this version? If not any chance it could be updated please.
Quote from: lurkalot on November 17, 2018, 01:38:53 PM
I use this plugin on my 1.5.x gallery, and really need it now I'm about to upgrade to 1.6.x anyone know if it's compatible with this version? If not any chance it could be updated please.
Quick look it needs minor tweaks to remove direct mysql calls...
It's André's plugin - so I'll give him the first shot to update it.
Quote from: gmc on November 17, 2018, 03:30:31 PM
Quick look it needs minor tweaks to remove direct mysql calls...
It's André's plugin - so I'll give him the first shot to update it.
Thank you. ;)
I did leave it installed when I upgraded didn't break the page or anything. I guess it won't work though if it needs those tweaks.
I'll have a look as soon as possible. When we're talking about cpg1.6.x compatibility we usually also mean PHP7 compatibility. If it works as expected with cpg1.6.x but contains direct mysql calls, it will stop to work as soon as your server is upgraded to PHP7. So if you're running cpg1.6.x with PHP5 there's a high chance it will work as expected. I'll make it compatible with PHP7 anyway.
Quote from: Αndré on November 17, 2018, 06:28:07 PM
I'll have a look as soon as possible. When we're talking about cpg1.6.x compatibility we usually also mean PHP7 compatibility. If it works as expected with cpg1.6.x but contains direct mysql calls, it will stop to work as soon as your server is upgraded to PHP7. So if you're running cpg1.6.x with PHP5 there's a high chance it will work as expected. I'll make it compatible with PHP7 anyway.
Thanks Andre. I'm running on php 5.6 currently, but making the move to php 7.+ soon as 5.6 is EOL at the end of the year, and Php 7 is end of life in a few days. So probably will be moving to 7.2
PHP7 compatible version can be found here: http://forum.coppermine-gallery.net/index.php/topic,79547.0.html