diff --git a/plugins/user/profile/fields/tos.php b/plugins/user/profile/fields/tos.php
index c635a367cff2e..836f0b773b3b7 100644
--- a/plugins/user/profile/fields/tos.php
+++ b/plugins/user/profile/fields/tos.php
@@ -71,25 +71,30 @@ protected function getLabel()
{
$label .= ' title="'
. htmlspecialchars(
- trim($text, ':') . '
' . ($this->translateDescription ? JText::_($this->description) : $this->description),
- ENT_COMPAT, 'UTF-8'
- ) . '"';
+ trim($text, ':') . '
' . ($this->translateDescription ? JText::_($this->description) : $this->description),
+ ENT_COMPAT, 'UTF-8'
+ ) . '"';
}
$tosarticle = $this->element['article'] > 0 ? (int) $this->element['article'] : 0;
- $link = '';
-
if ($tosarticle)
{
JLoader::register('ContentHelperRoute', JPATH_BASE . '/components/com_content/helpers/route.php');
- $attribs = array();
+ $attribs = array();
$attribs['class'] = 'modal';
- $attribs['rel'] = '{handler: \'iframe\', size: {x:800, y:500}}';
-
- // TODO: This is broken!! We need the category ID, too, and the language
- $url = ContentHelperRoute::getArticleRoute($tosarticle);
+ $attribs['rel'] = '{handler: \'iframe\', size: {x:800, y:500}}';
+
+ $db = JFactory::getDbo();
+ $query = $db->getQuery(true);
+ $query->select('id, alias, catid')
+ ->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);
$link = JHtml::_('link', JRoute::_($url . '&tmpl=component'), $text, $attribs);
}