4images Forum & Community
4images Help / Hilfe => Bug Fixes & Patches => Topic started by: V@no on December 23, 2008, 07:03:05 AM
-
When images deleted along with the comments the comments count per user is not being updated. Thanks to alekinna (http://www.4homepages.de/forum/index.php?topic=23642.0) for finding and providing the fix.
In admin/categories.php
Find 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.php
Find:function delete_images($image_ids, $delfromserver = 1) {
Insert below:
global $user_table_fields;