/** * Delete an inventory item * @param integer $inventory_id */ function delete($inventory_id) { // Remove item $success = $this->wpdb->query($this->wpdb->prepare("DELETE FROM " . $this->inventory_table . ' WHERE inventory_id = %d', $inventory_id . ' LIMIT 1')); if ($success) { $images_success = $this->delete_images($inventory_id); $media_success = $this->delete_media($inventory_id); if (!$images_success) { self::$message = $this->__('Inventory item deleted, but the images could not be deleted.') . '<br />'; } if (!$media_success) { self::$message = $this->__('Inventory item deleted, but the media could not be deleted.') . '<br />'; } } else { if ($success === 0) { self::$message = $this->__('The inventory item is already deleted.'); } else { self::$message = $this->__('Inventory item could not be deleted.'); } } return $success; }