diff --git a/plugins/user/profile/fields/tos.php b/plugins/user/profile/fields/tos.php index 2741cd9abede3..c8abd569967e7 100644 --- a/plugins/user/profile/fields/tos.php +++ b/plugins/user/profile/fields/tos.php @@ -88,13 +88,28 @@ protected function getLabel() $db = JFactory::getDbo(); $query = $db->getQuery(true); - $query->select('id, alias, catid') + $query->select('id, alias, catid, language') ->from('#__content') ->where('id = ' . $tosarticle); $db->setQuery($query); $article = $db->loadObject(); - $slug = $article->alias ? ($article->id . ':' . $article->alias) : $article->id; - $url = ContentHelperRoute::getArticleRoute($slug, $article->catid); + + if (JLanguageAssociations::isEnabled()) + { + $tosassociated = JLanguageAssociations::getAssociations('com_content', '#__content', 'com_content.item', $tosarticle); + } + + $current_lang = JFactory::getLanguage()->getTag(); + + if ($current_lang != $article->language && array_key_exists($current_lang, $tosassociated)) + { + $url = ContentHelperRoute::getArticleRoute($tosassociated[$current_lang]->id, $tosassociated[$current_lang]->catid); + } + else + { + $slug = $article->alias ? ($article->id . ':' . $article->alias) : $article->id; + $url = ContentHelperRoute::getArticleRoute($slug, $article->catid); + } $link = JHtml::_('link', JRoute::_($url . '&tmpl=component'), $text, $attribs); }