diff --git a/libraries/cms/helper/tags.php b/libraries/cms/helper/tags.php index 8589aeaf0e2dd..8fe2f9ddc0cca 100644 --- a/libraries/cms/helper/tags.php +++ b/libraries/cms/helper/tags.php @@ -617,9 +617,18 @@ public function getTagItemsQuery($tagId, $typesr = null, $includeChildren = fals $query->where('m.type_alias IN (' . implode(',', $typeAliases) . ')'); + JPluginHelper::importPlugin('tags'); + $dispatcher = JEventDispatcher::getInstance(); + $results = $dispatcher->trigger('onTagItemListQuery', array($query)); + + if (count($results) == 1) + { + $query = $results[0]; + } + $groups = '0,' . implode(',', array_unique($user->getAuthorisedViewLevels())); $query->where('c.core_access IN (' . $groups . ')') - ->group('m.type_alias, m.content_item_id, m.core_content_id, core_modified_time, core_created_time, core_created_by_alias, name, author_email'); + ->group('m.type_alias, m.content_item_id, m.core_content_id, core_modified_time, core_created_time, core_created_by_alias, ua.name, author_email'); // Use HAVING if matching all tags and we are matching more than one tag. if ($ntagsr > 1 && $anyOrAll != 1 && $includeChildren != 1)