I need a function to duplicate an (published) entry as a draft entry. Now if I duplicate an entry it will immediately publics that entry an that fires some plugin events (sends mails) I didn't want.
Asked
Active
Viewed 494 times
1
-
1I'm not sure I'm following 100%, but it sounds like you want to duplicate an entry and have it set to disabled by default? – Brad Bell Apr 21 '17 at 17:32
-
Sorry for my bad English I meant a draft entry not a concept entry (that's how we call it in Holland). The client publish a entry and after that he want to duplicate that published entry but as a draft and not immediately publish it because the client want to make some changes first and then publish the duplicated entry. After publishing a plugin sends a mail to all users. Therefore it should not be published immediately. – Maarten Heideman Apr 25 '17 at 10:32
-
No worries, Maarten... it'd definitely need to be done through a plugin and Brad answer is a good starting point. – Brad Bell Apr 26 '17 at 17:48
-
Is there any better/simpler solution to achieve this ? – Sebastien H. May 19 '20 at 14:39
1 Answers
1
You can refer to this How can I copy an entry?
Just change:
$newEntry->enabled = $oldEntry->enabled;
to
$newEntry->enabled = false;
To start out building your own plugin: https://pluginfactory.io/, be sure to select the Services lightswitch.
Brad
- 487
- 3
- 11