Skip to content

Commit 5bacf58

Browse files
authored
[4.0] Fix wrong link to category on user action log (#32280)
* Fix wrong link to category on User action log * Correct link to edit category form * Only get extension from category if it is not passed in the input
1 parent 63dbac1 commit 5bacf58

File tree

2 files changed

+17
-7
lines changed

2 files changed

+17
-7
lines changed

administrator/components/com_categories/src/Controller/CategoryController.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,18 @@ public function batch($model = null)
153153
protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id')
154154
{
155155
$append = parent::getRedirectToItemAppend($recordId);
156+
157+
// In case extension is not passed in the URL, get it directly from category instead of default to com_content
158+
if (!$this->input->exists('extension') && $recordId > 0)
159+
{
160+
$table = $this->getModel('Category')->getTable();
161+
162+
if ($table->load($recordId))
163+
{
164+
$this->extension = $table->extension;
165+
}
166+
}
167+
156168
$append .= '&extension=' . $this->extension;
157169

158170
return $append;

plugins/actionlog/joomla/joomla.php

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -96,23 +96,21 @@ public function onContentAfterSave($context, $article, $isNew): void
9696
$context = $this->contextAliases[$context];
9797
}
9898

99-
$option = $this->app->input->getCmd('option');
99+
$params = ActionlogsHelper::getLogContentTypeParams($context);
100100

101-
if (!$this->checkLoggable($option))
101+
// Not found a valid content type, don't process further
102+
if ($params === null)
102103
{
103104
return;
104105
}
105106

106-
$params = ActionlogsHelper::getLogContentTypeParams($context);
107+
list($option, $contentType) = explode('.', $params->type_alias);
107108

108-
// Not found a valid content type, don't process further
109-
if ($params === null)
109+
if (!$this->checkLoggable($option))
110110
{
111111
return;
112112
}
113113

114-
list(, $contentType) = explode('.', $params->type_alias);
115-
116114
if ($isNew)
117115
{
118116
$messageLanguageKey = $params->text_prefix . '_' . $params->type_title . '_ADDED';

0 commit comments

Comments
 (0)