Skip to content

Enhance Content - Contact plugin#18258

Merged
mbabker merged 4 commits intojoomla:3.9-devfrom
mattiaverga:author_links
Jun 12, 2018
Merged

Enhance Content - Contact plugin#18258
mbabker merged 4 commits intojoomla:3.9-devfrom
mattiaverga:author_links

Conversation

@mattiaverga
Copy link
Copy Markdown
Contributor

@mattiaverga mattiaverga commented Oct 6, 2017

Summary of Changes

Currently Content - Contact plugin can only link the author name to the internal page of the contact associated to the author of the article.
This PR enhances the plugin with the ability to choose the webpage or the email of the associated contact as link to the author.
An option is added if the admin doesn't want to apply links to the real author when an alias name is used as article author.

Testing Instructions

Enable "Show author" and "Link author" in global article options, or just in one article; enable Content - Contact plugin; associate a contact to the user who created the article.

Expected result

When the article is displayed, the author name will be linked to the internal contact page (this is the default and it works like before).
You can change the type of link in the plugin configuration: "website" will link the author name to the website specified in the contact details (if any); "email" will open the default email client to email to the address provided in contact details.

Actual result

Only the link to the internal contact page is available.

@joomla-cms-bot joomla-cms-bot added Language Change This is for Translators PR-staging labels Oct 6, 2017
@infograf768
Copy link
Copy Markdown
Member

infograf768 commented Oct 8, 2017

This works fine but needs some code improvements.
I modified your xml to fit

<?xml version="1.0" encoding="utf-8"?>
<extension version="3.2" type="plugin" group="content" method="upgrade">
	<name>plg_content_contact</name>
	<author>Joomla! Project</author>
	<creationDate>January 2014</creationDate>
	<copyright>Copyright (C) 2005 - 2017 Open Source Matters. All rights reserved.</copyright>
	<license>GNU General Public License version 2 or later; see LICENSE.txt</license>
	<authorEmail>admin@joomla.org</authorEmail>
	<authorUrl>www.joomla.org</authorUrl>
	<version>3.2.2</version>
	<description>PLG_CONTENT_CONTACT_XML_DESCRIPTION</description>
	<files>
		<filename plugin="contact">contact.php</filename>
	</files>
	<languages>
		<language tag="en-GB">en-GB.plg_content_contact.ini</language>
		<language tag="en-GB">en-GB.plg_content_contact.sys.ini</language>
	</languages>
	<config>
		<fields name="params">
			<fieldset name="basic">
				<field
					name="url"
					type="list"
					label="PLG_CONTENT_CONTACT_PARAM_URL_LABEL"
					description="PLG_CONTENT_CONTACT_PARAM_URL_DESCRIPTION"
					default="0"
				>
					<option value="0">PLG_CONTENT_CONTACT_PARAM_URL_0</option>
					<option value="1">PLG_CONTENT_CONTACT_PARAM_URL_1</option>
					<option value="2">PLG_CONTENT_CONTACT_PARAM_URL_2</option>
				</field>

				<field
					name="link_to_alias"
					type="radio"
					label="PLG_CONTENT_CONTACT_PARAM_ALIAS_LABEL"
					description="PLG_CONTENT_CONTACT_PARAM_ALIAS_DESCRIPTION"
					default="0"
					class="btn-group btn-group-yesno"
				>
					<option value="0">JNO</option>
					<option value="1">JYES</option>
				</field>
			</fieldset>
		</fields>
	</config>
</extension>

To get:

screen shot 2017-10-08 at 11 02 09

remark that we use JNO and JYES, therefore the strings

PLG_CONTENT_CONTACT_PARAM_YES="Yes"
PLG_CONTENT_CONTACT_PARAM_NO="No"

should be taken off the ini file.

Also the fields name do usually use lowercase characters.
I changed them to
url and link_to_alias
Which means they should be changed in code.

Also I would change
PLG_CONTENT_CONTACT_PARAM_URL_LABEL="URL to link to"
to maybe a simple
PLG_CONTENT_CONTACT_PARAM_URL_LABEL="Redirection"
as obviously an email is not an url :)

Also use lowercase for html tags in text strings, i.e. not <UL><LI> but <ul><li>

@brianteeman
Copy link
Copy Markdown
Contributor

@infograf768 the > needs to be indented like this

					default="0"
					>
					<option value="0">PLG_CONTENT_CONTACT_PARAM_URL_0</option>

@mattiaverga
Copy link
Copy Markdown
Contributor Author

Should the version number also be upgraded?

I have another doubt: in the xml the "extension version" is set to 3.2, but in php code the "protected $db;" code says it's available since 3.3...

@infograf768
Copy link
Copy Markdown
Member

No need to touch the versions.

@infograf768
Copy link
Copy Markdown
Member

I have tested this item ✅ successfully on 5693292

Works fine here. May need some tweaks to the values of the ini strings. @brianteeman


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/18258.

@ghost
Copy link
Copy Markdown

ghost commented Oct 9, 2017

I have tested this item ✅ successfully on 5693292

Handy Improvement, thanks.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/18258.

@ghost
Copy link
Copy Markdown

ghost commented Oct 9, 2017

RTC after two successful tests.

@joomla-cms-bot joomla-cms-bot added the RTC This Pull Request is Ready To Commit label Oct 9, 2017
@infograf768
Copy link
Copy Markdown
Member

@mbabker Please decide a milestone for this.

Comment thread plugins/content/contact/contact.xml Outdated
description="PLG_CONTENT_CONTACT_PARAM_URL_DESCRIPTION"
default="0"
>
<option value="0">PLG_CONTENT_CONTACT_PARAM_URL_0</option>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of 0/1/2 for the option values can we use text names so it's clear what each of these options are (so url/webpage/email).

@mattiaverga mattiaverga requested a review from brianteeman as a code owner June 3, 2018 07:44
Copy link
Copy Markdown
Contributor

@brianteeman brianteeman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

approve string changes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Language Change This is for Translators

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants