diff --git a/administrator/language/en-GB/en-GB.plg_content_contact.ini b/administrator/language/en-GB/en-GB.plg_content_contact.ini index 79e6236e05033..93e63fc8a0fc9 100644 --- a/administrator/language/en-GB/en-GB.plg_content_contact.ini +++ b/administrator/language/en-GB/en-GB.plg_content_contact.ini @@ -5,3 +5,10 @@ PLG_CONTENT_CONTACT="Content - Contact" PLG_CONTENT_CONTACT_XML_DESCRIPTION="Provides a link between the content author and the contact item that can be used for an Author Profile." +PLG_CONTENT_CONTACT_PARAM_URL_LABEL="Redirection" +PLG_CONTENT_CONTACT_PARAM_URL_DESCRIPTION="You can link the author name to:" +PLG_CONTENT_CONTACT_PARAM_URL_URL="Internal contact page" +PLG_CONTENT_CONTACT_PARAM_URL_WEBPAGE="Webpage from contact" +PLG_CONTENT_CONTACT_PARAM_URL_EMAIL="Email from contact" +PLG_CONTENT_CONTACT_PARAM_ALIAS_LABEL="Apply link also to alias name" +PLG_CONTENT_CONTACT_PARAM_ALIAS_DESCRIPTION="Link to the real user data even if an author alias is set in article options." diff --git a/plugins/content/contact/contact.php b/plugins/content/contact/contact.php old mode 100644 new mode 100755 index cabad322a2cbc..7412bd9348b01 --- a/plugins/content/contact/contact.php +++ b/plugins/content/contact/contact.php @@ -51,20 +51,36 @@ public function onContentPrepare($context, &$row, $params, $page = 0) 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->getContactId($row->created_by); + $contact = $this->getContactData($row->created_by); $row->contactid = $contact->contactid; + $row->webpage = $contact->webpage; + $row->email = $contact->email_to; - if ($row->contactid) + 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 = ''; @@ -80,7 +96,7 @@ public function onContentPrepare($context, &$row, $params, $page = 0) * * @return mixed|null|integer */ - protected function getContactId($created_by) + protected function getContactData($created_by) { static $contacts = array(); @@ -91,7 +107,7 @@ protected function getContactId($created_by) $query = $this->db->getQuery(true); - $query->select('MAX(contact.id) AS contactid, contact.alias, contact.catid'); + $query->select('MAX(contact.id) AS contactid, contact.alias, contact.catid, contact.webpage, contact.email_to'); $query->from($this->db->quoteName('#__contact_details', 'contact')); $query->where('contact.published = 1'); $query->where('contact.user_id = ' . (int) $created_by); diff --git a/plugins/content/contact/contact.xml b/plugins/content/contact/contact.xml old mode 100644 new mode 100755 index c68ceb84b4c8b..7ac1511a5077e --- a/plugins/content/contact/contact.xml +++ b/plugins/content/contact/contact.xml @@ -18,6 +18,31 @@ +
+ + + + + + + + + + +