我已经将Joomla 3.8更新为3.9,然后“作者作者链接”用户不再起作用。它没有显示单击它的任何链接,而且问题出在plugins / content / contact / contact.php上—当我用3.8版本之一替换它时,它显示了“作者撰写”链接.. < / p>
我已经使用Protostar模板对其进行了测试,但是存在相同的问题..
请问该如何解决?
如何将这个文件覆盖到模板中?
这是3.8版本的代码:
public function onContentPrepare($context, &$row, $params, $page = 0)
{
$allowed_contexts = array('com_content.category', 'com_content.article', 'com_content.featured');
if (!in_array($context, $allowed_contexts))
{
return true;
}
// Return if we don't have valid params or don't link the author
if (!($params instanceof Registry) || !$params->get('link_author'))
{
return true;
}
// Return if we don't have a valid article id
if (!isset($row->id) || !(int) $row->id)
{
return true;
}
$contact = $this->getContactId($row->created_by);
$row->contactid = $contact->contactid;
if ($row->contactid)
{
JLoader::register('ContactHelperRoute', JPATH_SITE . '/components/com_contact/helpers/route.php');
$row->contact_link = JRoute::_(ContactHelperRoute::getContactRoute($contact->contactid . ':' . $contact->alias, $contact->catid));
}
else
{
$row->contact_link = '';
}
return true;
}
这是Joomla 3.9的内容:
public function onContentPrepare($context, &$row, $params, $page = 0)
{
$allowed_contexts = array('com_content.category', 'com_content.article', 'com_content.featured');
if (!in_array($context, $allowed_contexts))
{
return true;
}
// Return if we don't have valid params or don't link the author
if (!($params instanceof Registry) || !$params->get('link_author'))
{
return true;
}
// Return if an alias is used
if ($this->params->get('link_to_alias') == 0 & $row->created_by_alias != '')
{
return true;
}
// Return if we don't have a valid article id
if (!isset($row->id) || !(int) $row->id)
{
return true;
}
$contact = $this->getContactData($row->created_by);
$row->contactid = $contact->contactid;
$row->webpage = $contact->webpage;
$row->email = $contact->email_to;
if ($row->contactid && $this->params->get('url') == 'url')
{
JLoader::register('ContactHelperRoute', JPATH_SITE . '/components/com_contact/helpers/route.php');
$row->contact_link = JRoute::_(ContactHelperRoute::getContactRoute($contact->contactid . ':' . $contact->alias, $contact->catid));
}
elseif ($row->webpage && $this->params->get('url') == 'webpage')
{
$row->contact_link = $row->webpage;
}
elseif ($row->email && $this->params->get('url') == 'email')
{
$row->contact_link = 'mailto:' . $row->email;
}
else
{
$row->contact_link = '';
}
return true;
}
谢谢 胺