open any existing articles, modify its titles and content and save as copy to a new article
any new articles that are create using save as copy method should have its own time stamp and consider as new article
new article created using save as copy has time stamp matching article that it copied. The new article will not be listed under recently added article in the dashboard
example of an article in the attachment "Yunmai Smart Scale ..." created using save as copy from article ID 5 "How embedded ..." doesn't appear on recently added articles and its time stamp dated 2017-07-01 instead of 2017-08.10 as per the version history
joomla 3.7.4 and earlier
php 7.1.8
MySQLi 5.5.56-cll-lve
using free domain from cloudaccess.net
Category | UI/UX | ⇒ | com_content UI/UX |
Status | New | ⇒ | Discussion |
Other than the created date, the published date also copied over. Don't tell me this is expected behavior as well. The primary issue raise here is the new article that uses save as copy won't appear in the recently added articles list, is that an expected behavior?
If both of the answer is yes. I have nothing more to say but the to comment such design are not a normal user behavior should expect.
This can be modified in the model line 569 by adding values for $data.
/administrator/components/com_content/models/article.php
if ($input->get('task') == 'save2copy')
{
$origTable = clone $this->getTable();
$origTable->load($input->getInt('id'));
if ($data['title'] == $origTable->title)
{
list($title, $alias) = $this->generateNewTitle($data['catid'], $data['alias'], $data['title']);
$data['title'] = $title;
$data['alias'] = $alias;
$data['created'] = JFactory::getDate('now', $offset)->format('%Y-%m-%d');
$data['modified'] = JFactory::getDate('now', $offset)->format('%Y-%m-%d');
$data['publish_up'] = '';
$data['publish_down'] = '';
}
else
etc.
And I do agree that if no one wants to modify the model, we should at least provide an Option (I know, I know, another option...)
The dates are only set to now if there isn't anything else existing, it's a default behavior (if you fill in the dates on a new item then those values are used). We don't arbitrarily change them after the fact because they are user editable data.
Its a difficult one. On the one hand you are saving a copy so you should expect to get a copy of all userdata and that includes the dates as they are user editable. On the other hand in your use case it makes sense for the date to always be new. I guess its a balance between what is the most common use case
thanks infograf768
Status | Discussion | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2017-08-15 14:24:42 |
Closed_By | ⇒ | eltonpang |
@eltonpang
Warning though! This would be overwritten when you update Joomla.
Also, you may have to add after $origTable->load($input->getInt('id'));
$offset = JFactory::getApplication()->get('offset');
thanks again infograf768, fully understand what I need to do on each Joomla update. I did test it to work on my site without the string $offset = JFactory::getApplication()->get('offset');
so it should be as followings:?
if ($input->get('task') == 'save2copy')
{
$origTable = clone $this->getTable();
$origTable->load($input->getInt('id'));
$offset = JFactory::getApplication()->get('offset');
if ($data['title'] == $origTable->title)
{
list($title, $alias) = $this->generateNewTitle($data['catid'], $data['alias'], $data['title']);
$data['title'] = $title;
$data['alias'] = $alias;
$data['created'] = JFactory::getDate('now', $offset)->format('%Y-%m-%d');
$data['modified'] = JFactory::getDate('now', $offset)->format('%Y-%m-%d');
$data['publish_up'] = '';
$data['publish_down'] = '';
}
else
I guess so. You should test by modifying the default server time zone.
take note that Published and Created Date of the copied articles will also follow its original article that it copied. e.g. if you pick an existing article that was created and publish on 2010-10-01 and use save as copy, modified its title and contents, the new article created and publish date will follow its original article date i.e. 2010-10-01
This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/17542.