4images Forum & Community
4images Issues / Ausgaben => Feedback & Suggestions => Topic started by: lisa on July 21, 2002, 11:38:32 PM
-
I would like to limit the number of photos a user can add to a gallery, ie user Kimo can only add 5 photos to Gallery A, 5 to Gallery B, etc.
I know some php and mySQL, so I can probably figure out how to do this if I am pointed in the right direction. Where in the code can I add a user photo limit?
Mahalo!!
-
Ja, das würde mich auch interessieren wie ich die Bilderanzahl pro User Limitieren könnte :)
______________
Yes, that interest me also, as one can do that! Pictures per user 10 !?
Jörg
-
I will interested in this feature, sometimes member upload more that 10 images on one day so this will sure a good feature to ad to the admin.
-
I created a really really bad hack for this:
in member.php, about line 236 (right before if ($action == "uploadform") { ) I added the following:
$user_id = $user_info['user_id'];
function check_cat_limit($cat_id, $user_id) {
$sql = "SELECT image_id FROM 4images_images WHERE cat_id=$cat_id AND user_id=$user_id";
$result = mysql_query($sql);
$cat_images_user = mysql_num_rows($result);
if($cat_images_user >= 5) {
return false;
} else {
return true;
}
}
and added "!check_cat_limit($cat_id, $user_id)" to the second line of if ($action == "uploadform") { as:
if ($cat_id != 0 && (!isset($cat_cache[$cat_id]) || !check_permission("auth_up
load", $cat_id) || !check_cat_limit($cat_id, $user_id))) {
Please note that this is hard-coded and applies to all user levels. The error message is just the incorrect login error, so it's not friendly. If you attempt to use this code and something goes wrong, please don't blame me. It seems to work ok for me, but I can't say if it will work for you.
Of course I would like to see a good solution, where the image limit is set per gallery through user levels. Until then, I will have to use my bad hack.
-
Very good idea Lisa! I have to try this out...
Thanks