User tests: Successful: Unsuccessful:
Pull Request for Issue # .
This PR adds support for Save As Copy article from frontend of your site
Status | New | ⇒ | Pending |
Category | ⇒ | Administration com_content Front End Language & Strings |
Labels |
Added:
?
?
|
I have tested this item
Received an error when accessing an unpublished article and then pressing either Save as Copy or Save: 0 Invalid field: Start Featured. The test was done in Beta8-dev updated to 26 February in Wampserver using PHP 8.0.2. However, the same error occurred after the patch was reverted.
The same Author user was able to save a new article without problems and the Publishing tab did not include any Featured option. When teh Author user edited this last article, the Featured option in Publishing showed 'No' and then pushing Save resulted the same error, 0 Invalid field: Start Featured
Will now install the lastest Beta8-dev from scratch for further testing.
I have tested this item
before applying the patch, there was no option named "SAVE AS COPY". After applying the patch , the option showed up and worked as expected.
@richard67 joomdonation Is it possible to turn off this feature?
We don't want a template override, we want an option button to turn this feature off.
this feature should be postponed to 4.1 we need j.4 release now.
The easiest way to switch it off is to use an account for frontend editing who has the permission to edit existing articles but not to create new ones.
@richard67 that's awkward way to switch it off, better way is an option button to turn this feature off.
can you provide real life data for article base on that existing article? To understand why you need this feature to be implemented?
@chnnst Joomla! has Save As Copy option for long time from administrator area. This PR just makes that option available for frontend.
If it is not needed, then people would not open this discussion #28092 . If it is not needed, then Joomla won't need Save As Copy feature in administrator area
You want Joomla 4 to release NOW, so please stop wasting time of other people to answer your questions for nothing.
Not even the Save button is working from the front end for an Author user in an unpatched out-of-the-box full version of Beta8-dev just installed today. The error message is always "0 Invalid field: Start Featured", independent of the state of Featured, whether the Start Featured date was selected from the Calendar icon or not.
I will raise a new item about this error.
Test environment:
Windows 10, Wampserver 3.2.4
Apache 2.4.46c, MySQL 8.0.23, PHP 8.0.2
@joomdonation your new feature which are not needed create new issues, please stop proposing them to j4 but better propose them to 4.1 or later .
We want Joomla 4 to release NOW, so please stop wasting time of other people, and better test release blockers.
@chnnst @joomdonation - The error "0 Invalid field: Start Featured" occurs in an out-of-the-box Beta8-dev in my Windows test environment with PHP 8.0.2, independent of any patches.
Here are the steps I followed:
Beta8-dev full version installed on Wampserver, PHP 8.0.2
Create an Author user.
Content - Categories and create a new category, 'My Category'.
Add a menu item to Main Menu, Create Article and select 'My Category' as the category.
Add a menu item to Main Menu, Category List, and select 'My Category' as the category.
Add a menu item to Main Menu, Category Blog, and select 'My Category' as the category.
Login as the Author user. Create an article from the front end.
The article shows as unpublished and assigned to My Category from the back end.
Publish the article.
Edit the article from the front end as the Author user.
The Featured field has the value No and Start Featured is blank.
Save the article.
Expected result: The article is saved
Result: 0 Invalid field: Start Featured
Go to the Category Blog and edit the article.
Change the option Feature to Yes and leave Start Featured blank.
Save - 0 Invalid field: Start Featured
Go to the Category Blog and edit the article.
Change the option Feature to Yes and select Today from the calendar link in the field Start Featured.
Clickin Save ends with "0 Invalid field: Start Featured"
The front end Author user already had the permissions 'Edit' and 'Edit State' to that particle article from Author to Publisher but was unable to save the article without the error. After the user group of this front end user was changed from Author to Publisher, this user was able to save the article without issues.
I will raise this as a new issue now.
It turns out that giving to the user group Author the permission to Edit State in an article or the category causes the error.
Changed the 'Edit State' permission to Inherited and therefore by calculation 'Not Allowed (Inherited)' in the article and granted the Edit State permission to Author in the category. When the Author tries to save the article from the front end, we get "0 Invalid field: Start Featured."
When the 'Edit State' permission is changed back to 'Inherited' and therefore by calculation 'Not Allowed (Inherited)', the Author user can save the article without any issues.
Perhaps this is not an issue. Should we say that an Author with the permission 'Edit State' should be a Publisher instead? Otherwise we will have an endless number of permutations of items, categories, user groups and permissions that some of our users think should work.
I have tested this item
I followed the instructions: logged in as Super User, edited Article in Front End and clicked Save as Copy - the new article was not created, any changes were saved in the existing article. I tried again, changed the Title and clicked Save as Copy - the existing article was saved with the new title. I tried in the back-end - the new article was created there. This was using a new clone created a couple of days ago.
@ceford You at least need to change Title of the article before press Save As Copy button to have article created, otherwise, you will see an error message
That same behavior is applied for Save As Copy button in the backend.
So in short, you need to change Title of the article (so that a unique Alias will be generated for the new article) to have the article created
@ceford You at least need to change Title of the article before press Save As Copy button to have article created, otherwise, you will see an error message
That same behavior is applied for Save As Copy button in the backend.
So in short, you need to change Title of the article (so that a unique Alias will be generated for the new article) to have the article created
In the backend test I did not change the Title - the system appended (2) to the existing title and created a new alias.
I am using Multi-lingual Test Data. I tried changing the article title with Save as Copy and it just save the existing article with the new title.
@joomdonation steps 1 - 3 = OK, but Step 4: "0 Invalid field: Start Featured."
Tested before: PR #32524 x was successful. Above PR I can't test, because I hv to revert previous PR :-)
What I'm doing wrong?
@ChristineWk Thanks for testing. We have a bug need to be fixed first before we can continue with this PR. So please wait until the PR #32524 is merged before testing it again
Many thanks !
@richard67 that's awkward way to switch it off, better way is an option button to turn this feature off.
can you provide real life data for article base on that existing article? To understand why you need this feature to be implemented?
In my case around 200 websites where authors everytime have to redo the same article structure in frontend, because save© doesn't exist. Only solution is let they can access to the admin, and this is wrong, really wrong.
Tested, after #32524 was merged.
I don't get a copy at all as is.
If I modify what looks like a typo in form edit
<button type="button" class="btn btn-primary" data-submit-task="article.save">
to
<button type="button" class="btn btn-primary" data-submit-task="article.save2copy">
Then I get an Errror Save failed with the following error: Another article from this category has the same alias (remember it may be a trashed item).
Category | Administration com_content Front End Language & Strings | ⇒ | Administration com_content Front End Language & Strings Libraries |
OK. Thanks for the feedback and testing. In the last commit, I addressed the following things:
The PR is now ready for testing. Please help test it again and give feedback. Thanks !
I have tested this item
Tested successfully in Beta8-dev of 27 February on Wampserver using PHP 8.0.2.
I have tested this item
It works, but...
I think the Cancel button should be a Close button - compare with the back end. I guess that is a separate issue.
@infograf768 Do you see this same error while creating article from frontend before this PR?
@joomdonation
Nope. And we do not have the issue in backend with or without PR.
@infograf768 We do not get issue in the backend because when article is created from backend, no email needs to be sent like in the frontend. So somehow, it is related to the code which process sending email when new article is created. I think it is not related to this PR but I will try to find out (don't know where the code for sending email is located yet)
/libraries/vendor/phpmailer/phpmailer/src/PHPMailer.php
public function preSend()
$this->setMessageType();
// Refuse to send an empty message unless we are specifically allowing it
if (!$this->AllowEmpty && empty($this->Body)) {
throw new Exception($this->lang('empty_message'), self::STOP_CRITICAL);
}
@infograf768 We need to find out where in the frontend article creation process email is sent.
Without your PR, I see the same error when creating a new article (and not editing one)
@infograf768 So it is un-related to this PR. Could you open a new issue for that, I can look at it later. Basically, you might get error when new article is created from frontend. As I mentioned, there is email sent somewhere and email body is empty somehow (maybe related to our new mail template component ?) ?
We can look at it later.
Code is in content plugin public function onContentAfterSave($context, $article, $isNew): void
$model_message = $this->app->bootComponent('com_messages')->getMVCFactory()
->createModel('Message', 'Administrator');
$model_message->save($message);
Could you open a new issue for that, I can look at it later.
yep
@infograf768 Thanks. Do we need more test for this PR?
Status | Pending | ⇒ | Ready to Commit |
rtc
Thanks @infograf768 . To maintainers, there is a change in FormController class which is included in this PR. So before merging this PR, please review and make sure that change does not contain any backward incompatibility issue. I opened a discussion for that #32534
I am moving this to 4.1, we are in beta and this is a new feature. Thank you all who have been working on this and bringing it to the state it is now. But if we want to get 4.0 out of the door we need to make a cut.
Side note: this decision has be discussed in the production department and the maintainers team. It's not just mine even if I support the decision.
Title |
|
@bembelimen can you have a look at it and merge it if ok?
Labels |
Added:
?
Language Change
?
Removed: ? ? |
Category | Administration com_content Front End Language & Strings Libraries | ⇒ | Unit Tests Repository Administration com_admin SQL |
Labels |
Added:
?
Removed: Language Change |
Category | Administration Unit Tests Repository com_admin SQL | ⇒ | Administration com_content Front End Language & Strings Libraries Modules |
Status | Ready to Commit | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2021-08-26 03:38:33 |
Closed_By | ⇒ | joomdonation | |
Labels |
Added:
Language Change
Removed: ? |
Sorry. I merged 4.0-dev into this branch and messed up the PR. Will close this one for now and redo it later.
Is it possible to turn off this feature?
Testing Instructions
can you provide data for article base on that existing article?