diff --git a/administrator/components/com_content/models/articles.php b/administrator/components/com_content/models/articles.php index c38c16b5d5293..9efb41156ed6c 100644 --- a/administrator/components/com_content/models/articles.php +++ b/administrator/components/com_content/models/articles.php @@ -206,9 +206,14 @@ protected function getListQuery() ->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access'); // Join over the categories. - $query->select('c.title AS category_title') + $query->select('c.title AS category_title, c.created_user_id AS category_uid, c.level AS category_level') ->join('LEFT', '#__categories AS c ON c.id = a.catid'); + // Join over the parent categories. + $query->select('parent.title AS parent_category_title, parent.id AS parent_category_id, + parent.created_user_id AS parent_category_uid, parent.level AS parent_category_level') + ->join('LEFT', '#__categories AS parent ON parent.id = c.parent_id'); + // Join over the users for the author. $query->select('ua.name AS author_name') ->join('LEFT', '#__users AS ua ON ua.id = a.created_by'); diff --git a/administrator/components/com_content/models/featured.php b/administrator/components/com_content/models/featured.php index 81af7d7f57f5d..ba976f33ea4a9 100644 --- a/administrator/components/com_content/models/featured.php +++ b/administrator/components/com_content/models/featured.php @@ -104,9 +104,14 @@ protected function getListQuery() ->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access'); // Join over the categories. - $query->select('c.title AS category_title') + $query->select('c.title AS category_title, c.created_user_id AS category_uid, c.level AS category_level') ->join('LEFT', '#__categories AS c ON c.id = a.catid'); + // Join over the parent categories. + $query->select('parent.title AS parent_category_title, parent.id AS parent_category_id, + parent.created_user_id AS parent_category_uid, parent.level AS parent_category_level') + ->join('LEFT', '#__categories AS parent ON parent.id = c.parent_id'); + // Join over the users for the author. $query->select('ua.name AS author_name') ->join('LEFT', '#__users AS ua ON ua.id = a.created_by'); diff --git a/administrator/components/com_content/views/articles/tmpl/default.php b/administrator/components/com_content/views/articles/tmpl/default.php index 14d5f48f0c6b9..df423febbc20d 100644 --- a/administrator/components/com_content/views/articles/tmpl/default.php +++ b/administrator/components/com_content/views/articles/tmpl/default.php @@ -137,6 +137,10 @@ $canCheckin = $user->authorise('core.manage', 'com_checkin') || $item->checked_out == $userId || $item->checked_out == 0; $canEditOwn = $user->authorise('core.edit.own', 'com_content.article.' . $item->id) && $item->created_by == $userId; $canChange = $user->authorise('core.edit.state', 'com_content.article.' . $item->id) && $canCheckin; + $canEditCat = $user->authorise('core.edit', 'com_content.category.' . $item->catid); + $canEditOwnCat = $user->authorise('core.edit.own', 'com_content.category.' . $item->catid) && $item->category_uid == $userId; + $canEditParCat = $user->authorise('core.edit', 'com_content.category.' . $item->parent_category_id); + $canEditOwnParCat = $user->authorise('core.edit.own', 'com_content.category.' . $item->parent_category_id) && $item->parent_category_uid == $userId; ?>