diff --git a/modules/gallery/models/item.php b/modules/gallery/models/item.php index 7dce9e51f8..44d79d5bb7 100644 --- a/modules/gallery/models/item.php +++ b/modules/gallery/models/item.php @@ -382,8 +382,7 @@ public function get_position($child_id) { SELECT COUNT(*) AS position FROM {items} WHERE parent_id = {$this->id} AND {$this->sort_column} <= (SELECT {$this->sort_column} - FROM {items} WHERE id = $child_id) - ORDER BY {$this->sort_column} {$this->sort_order}"); + FROM {items} WHERE id = $child_id)"); return $result->current()->position; }