User tests: Successful: Unsuccessful:
Pull Request for Issue # .
The TOS field in the user profile plugin permits to link an article containing the TOS text. This feature does not include MultiLanguage support. With this PR now the plugin will select the right article for the current used language between the available associated articles if the Language Associations option
is enabled.
Create a multisite web config
Enable the user profile plugin and its Language Associations option
Select an article for the TOS in the user profile plugin
Configure associated articles for the article selected before
Status | New | ⇒ | Pending |
Labels |
Added:
?
|
Category | ⇒ | Multilanguage Plugins |
Please make Travis happy:
FOUND 4 ERROR(S) AND 1 WARNING(S) AFFECTING 3 LINE(S)
--------------------------------------------------------------------------------
97 | WARNING | Inline control structures are discouraged
98 | ERROR | No space found after comma in function call
98 | ERROR | No space found after comma in function call
98 | ERROR | No space found after comma in function call
101 | ERROR | Expected "if (...)\n...{...}\n...else\n"; found "if (...)
| | ...{...}\n...else\n"
I.e. you should modify the PR to get:
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query->select('id, alias, catid, language')
->from('#__content')
->where('id = ' . $tosarticle);
$db->setQuery($query);
$article = $db->loadObject();
if (JLanguageAssociations::isEnabled())
{
$tosassociated = JLanguageAssociations::getAssociations('com_content', '#__content', 'com_content.item', $tosarticle);
}
$current_lang = JFactory::getLanguage()->getTag();
if ($current_lang != $article->language && array_key_exists($current_lang, $tosassociated))
{
$url = ContentHelperRoute::getArticleRoute($tosassociated[$current_lang]->id, $tosassociated[$current_lang]->catid);
}
else
{
$slug = $article->alias ? ($article->id . ':' . $article->alias) : $article->id;
$url = ContentHelperRoute::getArticleRoute($slug, $article->catid);
}
This PR has received new commits.
CC: @mikeveeckmans
I am sorry for the errors. I am quite new to all these tools like github and php_codesniffer and the first time I really try to collaborate to a big project like Joomla. I have now configured php_codesniffer to avoid making again this kind of errors and raised a new commit with the code fix. Please forgive me and thanks for your help and suggestions.
I have tested this item successfully on 0befa18
Great patch!
I have tested this item successfully on 0befa18
Thanks
This is a small patch but I am too happy and honoured to be appreciated by Guru like you!
Status | Pending | ⇒ | Ready to Commit |
RTC. Can go in 3.5.2.
Labels |
Added:
?
|
Milestone |
Added: |
Labels |
Added:
?
|
I don't agree with the statement "can go into 3.5.x", I think this is a new feature and in fact it change how the system works. After the patch you get a different article when there was an associated article before.
Title |
|
Title |
|
Milestone |
Removed: |
Milestone |
Added: |
As I said, if you have an associated article for the chosen TOC before you will get this article after the patch and this is a change how the system behaves.
Status | Ready to Commit | ⇒ | Fixed in Code Base |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2016-05-02 06:13:57 |
Closed_By | ⇒ | rdeutz |
Labels |
Removed:
?
|
I've a Notice & Warning with this patch, I've enabled TOS as the only mandatory field, mono-lingual site.
Notice: Undefined variable: tosassociated in plugins ...\user\profile\fields\tos.php on line 104
Warning: array_key_exists() expects parameter 2 to be array, null given in plugins ...\user\profile\fields\tos.php on line 104
I've inserted "$tosassociated = array();" couple of lines above as a quick fix.
I have tested this item successfully on 6751718
TEST OK
Entered a DUTCH TOS in the plugin as article, made association to UK version. When registering in the frontend on UK language I get the UK TOS.
(before patch i got a 404)
This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/9961.