Can anyone tell me what php I might need to change to set duplicate documents as "published" by default (rather than un-published). Let me know, thanks!
I think there is a setting in the site config for that. Please see Tools -> Configuation -> Site, look for Published by default (or similar option).
Hope this helps.
Hi zi,
That setting works when creating new documents, but when duplicating documents modx still sets the new, duplicated document to un-published. I think it will require a PHP change.. just not sure where that is!
-
☆ A M B ☆
- 24,524 Posts
Check the manager/processors/duplicate_content.processor.php file, around line 68 you’ll find:
// [FS#922] Should the published status be honored? - sirlancelot
// if ($modx->hasPermission('publish_document')) {
// if ($modx->config['publish_default'])
// $content['pub_date'] = $content['pub_date']; // should this be changed to 1?
// else $content['pub_date'] = 0;
// } else {
// User can't publish documents
// $content['published'] = $content['pub_date'] = 0;
// }
// Set the published status to unpublished by default (see above ... commit #3388)
$content['published'] = $content['pub_date'] = 0;
It was turning out to be an incredible can of worms to try to determine if the duplicate should be published or not. But you can change that if you want; just keep your changes in mind (and a copy of it somewhere) for when you want to upgrade your MODx installation.
Unfortunately the processor doesn’t call any of the document events, or it could be accomplished with a plugin instead of hacking the core.