Author Topic: Limit number of photos/user in gallery  (Read 7705 times)

0 Members and 1 Guest are viewing this topic.

Offline lisa

  • Pre-Newbie
  • Posts: 2
    • View Profile
    • http://www.windwardskies.com
Limit number of photos/user in gallery
« 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!!

Offline TheRiver

  • Pre-Newbie
  • Posts: 9
    • View Profile
Limit number of photos/user in gallery
« Reply #1 on: July 22, 2002, 10:35:59 AM »
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

Offline Mec4D

  • Jr. Member
  • **
  • Posts: 75
    • View Profile
    • http://www.mec4d.com
Limit number of photos/user in gallery
« Reply #2 on: July 23, 2002, 10:38:17 PM »
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.
Catharina

Offline lisa

  • Pre-Newbie
  • Posts: 2
    • View Profile
    • http://www.windwardskies.com
Really bad hack (not recommended for use)
« Reply #3 on: July 26, 2002, 11:57:19 PM »
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.

Offline Mec4D

  • Jr. Member
  • **
  • Posts: 75
    • View Profile
    • http://www.mec4d.com
Limit number of photos/user in gallery
« Reply #4 on: July 27, 2002, 12:06:34 AM »
Very good idea Lisa! I have to try this out...

Thanks
Catharina