Index: branches/5.0.x/core/units/helpers/themes_helper.php =================================================================== diff -u -r12306 -r12634 --- branches/5.0.x/core/units/helpers/themes_helper.php (.../themes_helper.php) (revision 12306) +++ branches/5.0.x/core/units/helpers/themes_helper.php (.../themes_helper.php) (revision 12634) @@ -1,6 +1,6 @@ getCurrentThemeId(); + } + $sql = 'SELECT ' . $this->Application->getUnitOption('c', 'IDField') . ' FROM ' . $this->Application->getUnitOption('c', 'TableName') . ' WHERE ( (NamedParentPath = ' . $this->Conn->qstr('Content/' . $template) . ') OR (IsSystem = 1 AND CachedTemplate = ' . $this->Conn->qstr($template) . ') ) - AND (ThemeId = ' . $this->getCurrentThemeId() . ' OR ThemeId = 0)'; + AND (ThemeId = ' . $theme_id . ($theme_id > 0 ? ' OR ThemeId = 0' : '') . ')'; + return $this->Conn->GetOne($sql); } } \ No newline at end of file