Skip to content

Instantly share code, notes, and snippets.

@rsanchez
Created November 14, 2011 15:12
Show Gist options
  • Save rsanchez/1364133 to your computer and use it in GitHub Desktop.
Save rsanchez/1364133 to your computer and use it in GitHub Desktop.
Duplicate entry with Safecracker
{!--example url: template_group/template/123--}
{exp:safecracker entry_id="{segment_3}" return="template_group/template/ENTRY_ID"}
...
{!--
this is the trick that duplicates the entry
even though entry_id 123 is LOADED into this form
this blank entry_id field will trick SC into thinking
this is a new entry
--}
<input type="hidden" name="entry_id" value="">
{/exp:safecracker}
{!-- add this code if you are using Matrix (w/ PHP on Input) --}
<?php $_GET['clone'] = 'y' ?>
@rsanchez
Copy link
Author

rsanchez commented Jan 7, 2012

Well, in this case the liveUrlTitle JS would not get loaded as it only works on "new" entries. You could certainly leave the value attribute empty for title and url_title (or any other field(s) for that matter) to not inherit those fields from the parent/cloned entry.

<input type="text" name="title" value="">

@rklaeboe
Copy link

rklaeboe commented Jan 8, 2012 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment