1
Mods & Plugins (Releases & Support) / Re: [Mod] User upload limits
« on: November 23, 2011, 01:08:25 PM »
Hi,
Very nice mod. i used it on version 1.7.10 with daily limit option.
I corrected this bug:
function check_daily_picture_limit($user_id) {
$sql = "SELECT user_limit FROM ".USERS_TABLE." WHERE user_id = $user_id";
$row = $site_db->query_firstrow($sql);
$upload_limit = ($row['user_limit']);
$site_template->register_vars("upload_limit", $upload_limit);
$limit_cutoff = time() - 60 * 60 * 24;
$sql = "SELECT COUNT(image_id) AS num_rows_all
FROM ".IMAGES_TABLE."
WHERE user_id=$user_id AND image_date > $limit_cutoff";
//WHERE image_active = 1 AND user_id=$user_id AND image_date > $limit_cutoff";
$row = $site_db->query_firstrow($sql);
$images_per_user = $row['num_rows_all'];
//look for unvalidated images too
$sql = "SELECT COUNT(image_id) AS num_rows_all
FROM ".IMAGES_TEMP_TABLE."
WHERE user_id=$user_id AND image_date > $limit_cutoff";
$row = $site_db->query_firstrow($sql);
$images_per_user = $images_per_user + $row['num_rows_all'];
$site_template->register_vars("images_per_user", $images_per_user);
return ($images_per_user <= $upload_limit);
}
On error page number of already uploaded images is not displayed - I corrected this too:
in lang file main.php:
$lang['show_my_images'] = "Number of submited images (accepted and awaiting for validation): ";
and in over_limit.html:
I used code from first post as base.
Very nice mod. i used it on version 1.7.10 with daily limit option.
I corrected this bug:
Quote
this mod is not working for unvalidated images.new version of check_daily_picture_limit function (file member.php):
User can upload many photos if there is a validation in that category. MOD only works for validated photos.
function check_daily_picture_limit($user_id) {
global $site_db, $site_template;
$sql = "SELECT user_limit FROM ".USERS_TABLE." WHERE user_id = $user_id";
$row = $site_db->query_firstrow($sql);
$upload_limit = ($row['user_limit']);
$site_template->register_vars("upload_limit", $upload_limit);
$limit_cutoff = time() - 60 * 60 * 24;
$sql = "SELECT COUNT(image_id) AS num_rows_all
FROM ".IMAGES_TABLE."
WHERE user_id=$user_id AND image_date > $limit_cutoff";
//WHERE image_active = 1 AND user_id=$user_id AND image_date > $limit_cutoff";
$row = $site_db->query_firstrow($sql);
$images_per_user = $row['num_rows_all'];
//look for unvalidated images too
$sql = "SELECT COUNT(image_id) AS num_rows_all
FROM ".IMAGES_TEMP_TABLE."
WHERE user_id=$user_id AND image_date > $limit_cutoff";
$row = $site_db->query_firstrow($sql);
$images_per_user = $images_per_user + $row['num_rows_all'];
$site_template->register_vars("images_per_user", $images_per_user);
return ($images_per_user <= $upload_limit);
}
On error page number of already uploaded images is not displayed - I corrected this too:
in lang file main.php:
$lang['show_my_images'] = "Number of submited images (accepted and awaiting for validation): ";
and in over_limit.html:
Code: [Select]
<p>{lang_no_limits_text}</p>
{lang_show_my_images}{images_per_user}
look it is no way to show via search screen unvalidated images (I removed this link)I used code from first post as base.