diff --git a/administrator/components/com_categories/models/fields/categoryedit.php b/administrator/components/com_categories/models/fields/categoryedit.php index a972f26ddd396..5245e44800665 100644 --- a/administrator/components/com_categories/models/fields/categoryedit.php +++ b/administrator/components/com_categories/models/fields/categoryedit.php @@ -143,7 +143,6 @@ protected function getOptions() $db = JFactory::getDbo(); $user = JFactory::getUser(); - $groups = implode(',', $user->getAuthorisedViewLevels()); $query = $db->getQuery(true) ->select('DISTINCT a.id AS value, a.title AS text, a.level, a.published, a.lft'); @@ -186,7 +185,12 @@ protected function getOptions() } // Filter categories on User Access Level - $subQuery->where('access IN (' . $groups . ')'); + // Filter by access level on categories. + if (!$user->authorise('core.admin')) + { + $groups = implode(',', $user->getAuthorisedViewLevels()); + $subQuery->where('access IN (' . $groups . ')'); + } $query->from('(' . (string) $subQuery . ') AS a') ->join('LEFT', $db->quoteName('#__categories') . ' AS b ON a.lft > b.lft AND a.rgt < b.rgt'); @@ -257,9 +261,6 @@ protected function getOptions() } } - // Get the current user object. - $user = JFactory::getUser(); - // For new items we want a list of categories you are allowed to create in. if ($oldCat == 0) {