Skip to content

Commit

Permalink
sets values to draft if not published
Browse files Browse the repository at this point in the history
  • Loading branch information
Dako390 committed Aug 23, 2021
1 parent 4fa2c49 commit b136c0c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
12 changes: 12 additions & 0 deletions administrator/components/com_content/src/Model/ArticleModel.php
Expand Up @@ -682,6 +682,7 @@ public function validate($form, $data, $group = null)
*
* @since 1.6
*/

public function save($data)
{
$input = Factory::getApplication()->input;
Expand All @@ -694,6 +695,17 @@ public function save($data)
$data['metadata']['author'] = $filter->clean($data['metadata']['author'], 'TRIM');
}

if(!isset($data['draft']) || $data['state'] != 1)
{
$data['draft'] = 1;
}

if($data['state'] == 1)
{
$data['draft'] = 0;
}


if (isset($data['created_by_alias']))
{
$data['created_by_alias'] = $filter->clean($data['created_by_alias'], 'TRIM');
Expand Down
2 changes: 2 additions & 0 deletions components/com_content/src/Model/ArticlesModel.php
Expand Up @@ -230,6 +230,8 @@ protected function getListQuery()
$db->quoteName('a.metakey'),
$db->quoteName('a.metadesc'),
$db->quoteName('a.access'),
$db->quoteName('a.draft'),
$db->quoteName('a.shared'),
$db->quoteName('a.hits'),
$db->quoteName('a.featured'),
$db->quoteName('a.language'),
Expand Down

0 comments on commit b136c0c

Please sign in to comment.