User tests: Successful: 2 Razzo1987, drmenzelit Unsuccessful: 0
Multilingual site
When using a Create Article menu item using a specific category, whatever the language set for that category, the default language field is always set to the site language and can also be modified, which can cause unwanted errors.
In a multilingual site, an article tagged to a specific language should only be in a category tagged to the same language or All languages.
This is now corrected here by limiting it to admin
We never remarked that overseen aspect because we had already a way in frontend to do that in the HtmlView.php
joomla-cms/components/com_content/src/View/Form/HtmlView.php
Lines 166 to 171 in 52fc4b8
preprocessForm()
method to check the language of the category and, if not set to All languages, force the article to be set to the same language and read-only.Note: The patch not only prevents error when the Create Article menu item deals with a specific category set to the same language as the site language, but also, cherry on the cake, let's create such menu items with a category set to another language than the site language. Both read-only.
For example:
One can have a Create Article menu item tagged to French and thus displayed in French frontend, with an English tagged specific category. The language field will be rightfully set as English per default and read-only.
As when one can do the more, one can do the less, let's test it.
Multilingual site with 2 languages.
Let's do the cherry on the cake :)
Create a Create Article menu item tagged to French with a specific category tagged to English in a French tagged menu.
Set access to Special.
Login frontend and click on the menu item.
Check the category and the language before submitting.
Check the Articles Manager for the new article.
Frontend menu item displayed
Article form showing category
Article form showing read-only language field
Articles Manager showing newly created article
One can have multiple Create Article menu items set to use different specific category (See my screenshot above).
Beware: once there is (are) such Create Article menu item(s), there should never be also a Create Article menu item NOT set to use a specific category.
Status | New | ⇒ | Pending |
Category | ⇒ | Administration com_content Front End |
Labels |
Added:
?
|
I have tested this item
Test FR 1 before patch
Test FR 2 after patch
Work correctly
@Quy Done. Tested changes OK without really knowing why it is better. ;)
To reduce the exposure of a code base to SQL Injection attacks by sending the query and the data separately.
For more information: https://www.techfry.com/joomla/prepared-statements-in-joomla-4
I have tested this item
Status | Pending | ⇒ | Ready to Commit |
rtc
tks for testing
The commit after @Razzo1987 's test was just a clean branch update, so that test is still valid. I've restored the test result in the issue tracker so it's properly counted.
Status | Ready to Commit | ⇒ | Fixed in Code Base |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2021-02-24 10:47:24 |
Closed_By | ⇒ | chmst | |
Labels |
Added:
?
|
Thanks!
@infograf768 Can you explain how to test this One can have multiple Create Article menu items set to use different specific category ?
What is expected result if you create 10 article menu items set to use different specific category ?
@chnnst you can create several menu items of type "create article" and in each one you define the category where the article should be stored.
Menu 1: Create article for Blog (Category Blog selected)
Menu 2: Create article for News (Category News selected)
Menu 3: Create article for Politics (Category Politics selected)
.....
Does this PR also solve or answer #32369 ?