├── README.md └── cccsetcreationdate ├── cccsetcreationdate.xml └── cccsetcreationdate.php /README.md: -------------------------------------------------------------------------------- 1 | # cccsetcreatedate 2 | A simple plugin to set the creation date of an article based on a custom field 3 | 4 | Custom Field is hard coded in the plugin and there is no update server yet. First draft. 5 | Not for production use yet 6 | -------------------------------------------------------------------------------- /cccsetcreationdate/cccsetcreationdate.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Set Creation Date 4 | COOLCAT creations 5 | September 2023 6 | COOLCAT creations 7 | GNU General Public License version 2 or later 8 | mail@coolcat-creations.com 9 | https://coolcat-creations.com 10 | 1.0.0b 11 | This plugin sets the creation date of articles based on a custom field. 12 | 13 | cccsetcreationdate.php 14 | 15 | 16 | -------------------------------------------------------------------------------- /cccsetcreationdate/cccsetcreationdate.php: -------------------------------------------------------------------------------- 1 | isClient('administrator')) { 19 | // Backend 20 | $input = $app->input; 21 | $formData = $input->get('jform', array(), 'array'); 22 | 23 | 24 | if (isset($formData['com_fields']['startdatum']) && !empty($formData['com_fields']['startdatum'])) { 25 | $article->created = Factory::getDate($formData['com_fields']['startdatum'])->toSql(); 26 | } 27 | } else { 28 | // Frontend 29 | $input = $app->input; 30 | $formData = $input->get('jform', array(), 'array'); 31 | 32 | if (isset($formData['com_fields']['startdatum']) && !empty($formData['com_fields']['startdatum'])) { 33 | $article->created = Factory::getDate($formData['com_fields']['startdatum'])->toSql(); 34 | } 35 | 36 | } 37 | 38 | return true; 39 | } 40 | } 41 | --------------------------------------------------------------------------------