We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 32319
    • 129 Posts
    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:
    .$row['published']
    to
    .$row['unpublished']


    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?
      "Regret for the things we did can be tempered by time; it is regret for the things we did not do that is inconsolable."
      -- Sydney Harris
      • 23491 ☆ A M B ☆
      • 1,056 Posts
      Duplicating a document should pretty much be an exact mirror, IMO.( Minus conflicting things like Alias, etc... )

      However, you do bring up a very good point. I agree it would be nice to have this be an option in the manager. Otherwise, it should probably just clone the original document id...
        Mike Reid - www.pixelchutes.com
        MODx Ambassador / Contributor
        [Module] MultiMedia Manager / [Module] SiteSearch / [Snippet] DocPassword / [Plugin] EditArea / We support FoxyCart
        ________________________________
        Where every pixel matters.
        • 32319
        • 129 Posts
        Quote from: pixelchutes at Feb 20, 2007, 12:44 PM

        Duplicating a document should pretty much be an exact mirror, IMO.( Minus conflicting things like Alias, etc... )

        However, you do bring up a very good point. I agree it would be nice to have this be an option in the manager. Otherwise, it should probably just clone the original document id...

        Well, there is an option that lets you say that new documents should be unpublished and a duplicated document basically is a new document based on an existing document. With that rationale, a duplicate of a published page should be unpublished if the manager is set to create new pages as unpublished.
          "Regret for the things we did can be tempered by time; it is regret for the things we did not do that is inconsolable."
          -- Sydney Harris
          • 27376
          • 576 Posts
          I’d have to side with it being un-published by default for the reason that if you’re working on a production site, someone might happen across you making some changes and see the "Duplicate of ..." document in the menu....

          I also think, however, this should be an option in the manager, seeing as there is a difference of opinion smiley