From c5fc364abb9fd660107d51b1cfc04f977ce7cd9d Mon Sep 17 00:00:00 2001 From: SharkyKZ Date: Tue, 15 May 2018 15:33:34 +0000 Subject: [PATCH 1/4] Update profile.xml --- plugins/user/profile/profile.xml | 46 ++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/plugins/user/profile/profile.xml b/plugins/user/profile/profile.xml index 57227ca6e41ca..e478d6837c6cb 100644 --- a/plugins/user/profile/profile.xml +++ b/plugins/user/profile/profile.xml @@ -33,6 +33,8 @@ type="list" label="PLG_USER_PROFILE_FIELD_ADDRESS1_LABEL" description="PLG_USER_PROFILE_FIELD_ADDRESS1_DESC" + default="1" + filter="integer" > @@ -44,6 +46,8 @@ type="list" label="PLG_USER_PROFILE_FIELD_ADDRESS2_LABEL" description="PLG_USER_PROFILE_FIELD_ADDRESS2_DESC" + default="1" + filter="integer" > @@ -55,6 +59,8 @@ type="list" label="PLG_USER_PROFILE_FIELD_CITY_LABEL" description="PLG_USER_PROFILE_FIELD_CITY_DESC" + default="1" + filter="integer" > @@ -66,6 +72,8 @@ type="list" label="PLG_USER_PROFILE_FIELD_REGION_LABEL" description="PLG_USER_PROFILE_FIELD_REGION_DESC" + default="1" + filter="integer" > @@ -77,6 +85,8 @@ type="list" label="PLG_USER_PROFILE_FIELD_COUNTRY_LABEL" description="PLG_USER_PROFILE_FIELD_COUNTRY_DESC" + default="1" + filter="integer" > @@ -88,6 +98,8 @@ type="list" label="PLG_USER_PROFILE_FIELD_POSTAL_CODE_LABEL" description="PLG_USER_PROFILE_FIELD_POSTAL_CODE_DESC" + default="1" + filter="integer" > @@ -99,6 +111,8 @@ type="list" label="PLG_USER_PROFILE_FIELD_PHONE_LABEL" description="PLG_USER_PROFILE_FIELD_PHONE_DESC" + default="1" + filter="integer" > @@ -110,6 +124,8 @@ type="list" label="PLG_USER_PROFILE_FIELD_WEB_SITE_LABEL" description="PLG_USER_PROFILE_FIELD_WEB_SITE_DESC" + default="1" + filter="integer" > @@ -121,6 +137,8 @@ type="list" label="PLG_USER_PROFILE_FIELD_FAVORITE_BOOK_LABEL" description="PLG_USER_PROFILE_FIELD_FAVORITE_BOOK_DESC" + default="1" + filter="integer" > @@ -132,6 +150,8 @@ type="list" label="PLG_USER_PROFILE_FIELD_ABOUT_ME_LABEL" description="PLG_USER_PROFILE_FIELD_ABOUT_ME_DESC" + default="1" + filter="integer" > @@ -144,6 +164,7 @@ label="PLG_USER_PROFILE_FIELD_TOS_LABEL" description="PLG_USER_PROFILE_FIELD_TOS_DESC" default="0" + filter="integer" > @@ -158,6 +179,7 @@ new="true" edit="true" clear="true" + filter="integer" /> @@ -189,6 +213,8 @@ type="list" label="PLG_USER_PROFILE_FIELD_ADDRESS1_LABEL" description="PLG_USER_PROFILE_FIELD_ADDRESS1_DESC" + default="1" + filter="integer" > @@ -200,6 +226,8 @@ type="list" label="PLG_USER_PROFILE_FIELD_ADDRESS2_LABEL" description="PLG_USER_PROFILE_FIELD_ADDRESS2_DESC" + default="1" + filter="integer" > @@ -211,6 +239,8 @@ type="list" label="PLG_USER_PROFILE_FIELD_CITY_LABEL" description="PLG_USER_PROFILE_FIELD_CITY_DESC" + default="1" + filter="integer" > @@ -222,6 +252,8 @@ type="list" label="PLG_USER_PROFILE_FIELD_REGION_LABEL" description="PLG_USER_PROFILE_FIELD_REGION_DESC" + default="1" + filter="integer" > @@ -233,6 +265,8 @@ type="list" label="PLG_USER_PROFILE_FIELD_COUNTRY_LABEL" description="PLG_USER_PROFILE_FIELD_COUNTRY_DESC" + default="1" + filter="integer" > @@ -244,6 +278,8 @@ type="list" label="PLG_USER_PROFILE_FIELD_POSTAL_CODE_LABEL" description="PLG_USER_PROFILE_FIELD_POSTAL_CODE_DESC" + default="1" + filter="integer" > @@ -255,6 +291,8 @@ type="list" label="PLG_USER_PROFILE_FIELD_PHONE_LABEL" description="PLG_USER_PROFILE_FIELD_PHONE_DESC" + default="1" + filter="integer" > @@ -266,6 +304,8 @@ type="list" label="PLG_USER_PROFILE_FIELD_WEB_SITE_LABEL" description="PLG_USER_PROFILE_FIELD_WEB_SITE_DESC" + default="1" + filter="integer" > @@ -277,6 +317,8 @@ type="list" label="PLG_USER_PROFILE_FIELD_FAVORITE_BOOK_LABEL" description="PLG_USER_PROFILE_FIELD_FAVORITE_BOOK_DESC" + default="1" + filter="integer" > @@ -288,6 +330,8 @@ type="list" label="PLG_USER_PROFILE_FIELD_ABOUT_ME_LABEL" description="PLG_USER_PROFILE_FIELD_ABOUT_ME_DESC" + default="1" + filter="integer" > @@ -299,6 +343,8 @@ type="list" label="PLG_USER_PROFILE_FIELD_DOB_LABEL" description="PLG_USER_PROFILE_FIELD_DOB_DESC" + default="1" + filter="integer" > From 6db1fe95657907b8137ce4c45569569bc1b7e64b Mon Sep 17 00:00:00 2001 From: SharkyKZ Date: Tue, 15 May 2018 15:33:58 +0000 Subject: [PATCH 2/4] Update profile.xml --- plugins/user/profile/profiles/profile.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/user/profile/profiles/profile.xml b/plugins/user/profile/profiles/profile.xml index 77b0e96c82c46..c548885463234 100644 --- a/plugins/user/profile/profiles/profile.xml +++ b/plugins/user/profile/profiles/profile.xml @@ -121,6 +121,7 @@ label="PLG_USER_PROFILE_FIELD_TOS_LABEL" description="PLG_USER_PROFILE_FIELD_TOS_DESC" default="0" + filter="integer" > From 24c5f3b519f427acd858324311c62f968d485026 Mon Sep 17 00:00:00 2001 From: SharkyKZ Date: Tue, 15 May 2018 17:38:12 +0000 Subject: [PATCH 3/4] Update profile.php --- plugins/user/profile/profile.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/plugins/user/profile/profile.php b/plugins/user/profile/profile.php index e9b2253945caa..cbe99bd65805d 100644 --- a/plugins/user/profile/profile.php +++ b/plugins/user/profile/profile.php @@ -279,11 +279,11 @@ public function onContentPrepareForm($form, $data) $form->setFieldAttribute('tos', 'description', 'PLG_USER_PROFILE_FIELD_TOS_DESC_SITE', 'profile'); } - $tosarticle = $this->params->get('register_tos_article'); - $tosenabled = $this->params->get('register-require_tos', 0); + $tosArticle = $this->params->get('register_tos_article'); + $tosEnabled = $this->params->get('register-require_tos', 0); // We need to be in the registration form and field needs to be enabled - if ($name !== 'com_users.registration' || !$tosenabled) + if ($name !== 'com_users.registration' || !$tosEnabled) { // We only want the TOS in the registration form $form->removeField('tos', 'profile'); @@ -291,7 +291,7 @@ public function onContentPrepareForm($form, $data) else { // Push the TOS article ID into the TOS field. - $form->setFieldAttribute('tos', 'article', $tosarticle, 'profile'); + $form->setFieldAttribute('tos', 'article', $tosArticle, 'profile'); } foreach ($fields as $field) @@ -388,11 +388,11 @@ public function onUserBeforeSave($user, $isnew, $data) // Check that the tos is checked if required ie only in registration from frontend. $task = JFactory::getApplication()->input->getCmd('task'); $option = JFactory::getApplication()->input->getCmd('option'); - $tosarticle = $this->params->get('register_tos_article'); - $tosenabled = ($this->params->get('register-require_tos', 0) == 2); + $tosArticle = $this->params->get('register_tos_article'); + $tosEnabled = ($this->params->get('register-require_tos', 0) == 2); // Check that the tos is checked. - if ($task === 'register' && $tosenabled && $tosarticle && $option === 'com_users' && !$data['profile']['tos']) + if ($task === 'register' && $tosEnabled && $tosArticle && $option === 'com_users' && !$data['profile']['tos']) { throw new InvalidArgumentException(JText::_('PLG_USER_PROFILE_FIELD_TOS_DESC_SITE')); } From bc85b9c11fabb72900c075341c6c1422b96c3645 Mon Sep 17 00:00:00 2001 From: SharkyKZ Date: Tue, 15 May 2018 19:33:55 +0000 Subject: [PATCH 4/4] Update tos.php --- plugins/user/profile/field/tos.php | 38 +++++++++++++++++------------- 1 file changed, 22 insertions(+), 16 deletions(-) diff --git a/plugins/user/profile/field/tos.php b/plugins/user/profile/field/tos.php index 4c167c7d589e5..1a714d87cab40 100644 --- a/plugins/user/profile/field/tos.php +++ b/plugins/user/profile/field/tos.php @@ -59,7 +59,7 @@ protected function getLabel() JHtml::_('behavior.modal'); // Build the class for the label. - $class = !empty($this->description) ? 'hasTooltip' : ''; + $class = !empty($this->description) ? 'hasPopover' : ''; $class = $class . ' required'; $class = !empty($this->labelClass) ? $class . ' ' . $this->labelClass : $class; @@ -69,16 +69,17 @@ protected function getLabel() // If a description is specified, use it to build a tooltip. if (!empty($this->description)) { - $label .= ' title="' - . htmlspecialchars( - trim($text, ':') . '
' . ($this->translateDescription ? JText::_($this->description) : $this->description), - ENT_COMPAT, 'UTF-8' - ) . '"'; + $label .= ' title="' . htmlspecialchars(trim($text, ':'), ENT_COMPAT, 'UTF-8') . '"'; + $label .= ' data-content="' . htmlspecialchars( + $this->translateDescription ? JText::_($this->description) : $this->description, + ENT_COMPAT, + 'UTF-8' + ) . '"'; } - $tosarticle = $this->element['article'] > 0 ? (int) $this->element['article'] : 0; + $tosArticle = $this->element['article'] > 0 ? (int) $this->element['article'] : 0; - if ($tosarticle) + if ($tosArticle) { JLoader::register('ContentHelperRoute', JPATH_BASE . '/components/com_content/helpers/route.php'); @@ -90,27 +91,32 @@ protected function getLabel() $query = $db->getQuery(true); $query->select('id, alias, catid, language') ->from('#__content') - ->where('id = ' . $tosarticle); + ->where('id = ' . $tosArticle); $db->setQuery($query); $article = $db->loadObject(); if (JLanguageAssociations::isEnabled()) { - $tosassociated = JLanguageAssociations::getAssociations('com_content', '#__content', 'com_content.item', $tosarticle); + $tosAssociated = JLanguageAssociations::getAssociations('com_content', '#__content', 'com_content.item', $tosArticle); } - $current_lang = JFactory::getLanguage()->getTag(); + $currentLang = JFactory::getLanguage()->getTag(); - if (isset($tosassociated) && $current_lang !== $article->language && array_key_exists($current_lang, $tosassociated)) + if (isset($tosAssociated) && $currentLang !== $article->language && array_key_exists($currentLang, $tosAssociated)) { - $url = ContentHelperRoute::getArticleRoute($tosassociated[$current_lang]->id, $tosassociated[$current_lang]->catid); - $link = JHtml::_('link', JRoute::_($url . '&tmpl=component&lang=' . $tosassociated[$current_lang]->language), $text, $attribs); + $url = ContentHelperRoute::getArticleRoute( + $tosAssociated[$currentLang]->id, + $tosAssociated[$currentLang]->catid, + $tosAssociated[$currentLang]->language + ); + + $link = JHtml::_('link', JRoute::_($url . '&tmpl=component'), $text, $attribs); } else { $slug = $article->alias ? ($article->id . ':' . $article->alias) : $article->id; - $url = ContentHelperRoute::getArticleRoute($slug, $article->catid); - $link = JHtml::_('link', JRoute::_($url . '&tmpl=component&lang=' . $article->language), $text, $attribs); + $url = ContentHelperRoute::getArticleRoute($slug, $article->catid, $article->language); + $link = JHtml::_('link', JRoute::_($url . '&tmpl=component'), $text, $attribs); } } else