When images deleted along with the comments the comments count per user is not being updated. Thanks to
alekinna for finding and providing the fix.
In
admin/categories.phpFind
TWO times:
$sql = "DELETE FROM ".COMMENTS_TABLE."Insert
above EACH:
global $user_table_fields;
if (!empty($user_table_fields['user_comments']))
{
$sql = "SELECT user_id
FROM ".COMMENTS_TABLE."
WHERE image_id IN ($image_ids_sql) AND user_id <> ".GUEST;
$result = $site_db->query($sql);
while ($row = $site_db->fetch_array($result))
{
$sql = "UPDATE ".USERS_TABLE."
SET ".get_user_table_field("", "user_comments")." = ".get_user_table_field("", "user_comments")." - 1
WHERE ".get_user_table_field("", "user_id")." = ".$row['user_id'];
$site_db->query($sql);
}
}
Open
admin/images.phpFind:
function delete_images($image_ids, $delfromserver = 1) {Insert
below:
global $user_table_fields;