diff --git a/administrator/components/com_content/models/article.php b/administrator/components/com_content/models/article.php index 5673cf99d3cf8..2b728bbabf994 100644 --- a/administrator/components/com_content/models/article.php +++ b/administrator/components/com_content/models/article.php @@ -371,6 +371,7 @@ public function getItem($pk = null) public function getForm($data = array(), $loadData = true) { $app = JFactory::getApplication(); + $user = JFactory::getUser(); // Get the form. $form = $this->loadForm('com_content.article', 'article', array('control' => 'jform', 'load_data' => $loadData)); @@ -402,10 +403,14 @@ public function getForm($data = array(), $loadData = true) $form->setFieldAttribute('catid', 'action', 'core.edit.own'); } else - // Existing record. We can't edit the category in frontend. + // Existing record. We can't edit the category in frontend if not edit.state. { - $form->setFieldAttribute('catid', 'readonly', 'true'); - $form->setFieldAttribute('catid', 'filter', 'unset'); + if ($id != 0 && (!$user->authorise('core.edit.state', 'com_content.article.' . (int) $id)) + || ($id == 0 && !$user->authorise('core.edit.state', 'com_content'))) + { + $form->setFieldAttribute('catid', 'readonly', 'true'); + $form->setFieldAttribute('catid', 'filter', 'unset'); + } } } else @@ -414,8 +419,6 @@ public function getForm($data = array(), $loadData = true) $form->setFieldAttribute('catid', 'action', 'core.create'); } - $user = JFactory::getUser(); - // Check for existing article. // Modify the form based on Edit State access controls. if ($id != 0 && (!$user->authorise('core.edit.state', 'com_content.article.' . (int) $id))