When a published document is duplicated its duplicate is set to the published state even when the Web sites settings are set to make new documents unpublished. This is specifically a problem on a live site since duplicating a published document results in the duplicate showing up right away in site menus with the "duplicate of ..." title. In every circumstance I can think of, the user would want this duplicate set as unpublished by default.
I am not much of a PHP programmer so I wanted to share my novice fix and see if anyone with more experience wants to chime in... be gentle...
in the file duplicate_content.processor.php I replaced line 75:
('".$row['type']."', '".$row['contentType']."', '".mysql_escape_string($row['pagetitle'])."', '".mysql_escape_string($row['longtitle'])."', '".mysql_escape_string($row['description'])."', NULL, '".$row['published']."', '".$row['pub_date']."', '".$row['unpub_date']."', '".$row['parent']."', '".$row['isfolder']."', '".mysql_escape_string($row['introtext'])."', '".mysql_escape_string($row['content'])."', '".$row['richtext']."', '".$row['template']."', '".$row['menuindex']."', '".$row['searchable']."', '".$row['cacheable']."', $userID, UNIX_TIMESTAMP(), 0, 0, 0, 0, 0, '".mysql_escape_string($row['menutitle'])."', '".$row['donthit']."', '".$row['privateweb']."', '".$row['privatemgr']."', ".$row['content_dispo'].", ".$row['hidemenu'].");";
with:
('".$row['type']."', '".$row['contentType']."', '".mysql_escape_string($row['pagetitle'])."', '".mysql_escape_string($row['longtitle'])."', '".mysql_escape_string($row['description'])."', NULL, '".$row['unpublished']."', '".$row['pub_date']."', '".$row['unpub_date']."', '".$row['parent']."', '".$row['isfolder']."', '".mysql_escape_string($row['introtext'])."', '".mysql_escape_string($row['content'])."', '".$row['richtext']."', '".$row['template']."', '".$row['menuindex']."', '".$row['searchable']."', '".$row['cacheable']."', $userID, UNIX_TIMESTAMP(), 0, 0, 0, 0, 0, '".mysql_escape_string($row['menutitle'])."', '".$row['donthit']."', '".$row['privateweb']."', '".$row['privatemgr']."', ".$row['content_dispo'].", ".$row['hidemenu'].");";
Specifically:
to
Then made the same change on line 127.
Now when a published or unpublished document is duplicated it defaults to an unpublished state.
For all I know this is some kind of brutal hack with all kinds of negative consequences but it seems to get the job done.
Edit: Actually, now that I take a closer look at the code I think this is totally wrong. I think what I have done is break the duplication of the published setting so it is probably just using the default site settings which does what I want. Pretty sure I could put anything where i put "unpublished" and it would have the same result. Maybe a better solution would be to just remove the "published" field from the duplication. And what impact might this have on publication dates. Maybe those should not be copied as well. Anyone have 2 cents?