Duplicate Post - Version 3.2

Version Description

new website + WPML compatibility + various fixes

Download this release

Release Info

Developer lopo
Plugin Icon 128x128 Duplicate Post
Version 3.2
Comparing to
See all releases

Code changes from version 3.1.2 to 3.2

compat/duplicate-post-jetpack.php ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ add_action( 'admin_init', 'duplicate_post_jetpack_init' );
3
+
4
+
5
+ function duplicate_post_jetpack_init() {
6
+ add_filter('duplicate_post_blacklist_filter', 'duplicate_post_jetpack_add_to_blacklist', 10, 1 );
7
+
8
+ if (class_exists('WPCom_Markdown')){
9
+ add_action('duplicate_post_pre_copy', 'duplicate_post_jetpack_disable_markdown', 10);
10
+ add_action('duplicate_post_post_copy', 'duplicate_post_jetpack_enable_markdown', 10);
11
+ }
12
+ }
13
+
14
+ function duplicate_post_jetpack_add_to_blacklist($meta_blacklist) {
15
+ $meta_blacklist[] = '_wpas*'; //Jetpack Publicize
16
+ $meta_blacklist[] = '_publicize*'; //Jetpack Publicize
17
+
18
+ $meta_blacklist[] = '_jetpack*'; //Jetpack Subscriptions etc.
19
+
20
+ return $meta_blacklist;
21
+ }
22
+
23
+ // Markdown
24
+ function duplicate_post_jetpack_disable_markdown(){
25
+ WPCom_Markdown::get_instance()->unload_markdown_for_posts();
26
+ }
27
+
28
+ function duplicate_post_jetpack_enable_markdown(){
29
+ WPCom_Markdown::get_instance()->load_markdown_for_posts();
30
+ }
compat/duplicate-post-wpml.php ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ add_action( 'admin_init', 'duplicate_post_wpml_init' );
3
+
4
+ function duplicate_post_wpml_init() {
5
+ if ( defined( 'ICL_SITEPRESS_VERSION' ) ) {
6
+ add_action('dp_duplicate_page', 'duplicate_post_wpml_copy_translations', 10, 3);
7
+ add_action('dp_duplicate_post', 'duplicate_post_wpml_copy_translations', 10, 3);
8
+ }
9
+ }
10
+
11
+ function duplicate_post_wpml_copy_translations($post_id, $post, $status = '') {
12
+ global $sitepress;
13
+
14
+ remove_action('dp_duplicate_page', 'duplicate_post_wpml_copy_translations', 10);
15
+ remove_action('dp_duplicate_post', 'duplicate_post_wpml_copy_translations', 10);
16
+
17
+ $current_language = $sitepress->get_current_language();
18
+ $trid = $sitepress->get_element_trid($post->ID);
19
+ if (!empty($trid)) {
20
+ $translations = $sitepress->get_element_translations($trid);
21
+ $new_trid = $sitepress->get_element_trid($post_id);
22
+ foreach ($translations as $code => $details) {
23
+ if ($code != $current_language) {
24
+ $translation = get_post($details->element_id);
25
+ $new_post_id = duplicate_post_create_duplicate($translation, $status);
26
+ $sitepress->set_element_language_details($new_post_id, 'post_' . $translation->post_type, $new_trid, $code, $current_language);
27
+ }
28
+ }
29
+ }
30
+ }
31
+ ?>
duplicate-post-admin.php CHANGED
@@ -5,6 +5,9 @@ if(!is_admin())
5
 
6
  require_once (dirname(__FILE__).'/duplicate-post-options.php');
7
 
 
 
 
8
  /**
9
  * Wrapper for the option 'duplicate_post_version'
10
  */
@@ -19,11 +22,70 @@ function duplicate_post_get_current_version() {
19
  return DUPLICATE_POST_CURRENT_VERSION;
20
  }
21
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
22
  /**
23
  * Plugin upgrade
24
  */
25
- add_action('admin_init','duplicate_post_plugin_upgrade');
26
-
27
  function duplicate_post_plugin_upgrade() {
28
  $installed_version = duplicate_post_get_installed_version();
29
 
@@ -123,59 +185,43 @@ function duplicate_post_plugin_upgrade() {
123
 
124
  }
125
 
126
- if (get_option('duplicate_post_show_row') == 1){
127
- add_filter('post_row_actions', 'duplicate_post_make_duplicate_link_row',10,2);
128
- add_filter('page_row_actions', 'duplicate_post_make_duplicate_link_row',10,2);
129
- }
130
-
131
-
132
- if (get_site_option('duplicate_post_show_notice') == 1){
133
- /**
134
- * Shows the update notice
135
- */
136
- function duplicate_post_show_update_notice() {
137
- if(!current_user_can( 'manage_options')) return;
138
- $class = 'notice is-dismissible';
139
- $message = '<strong>'.esc_html__('Duplicate Post has new features!', 'duplicate-post').'</strong><br/>';
140
- $message .= '<em>'.esc_html__('Clone posts in bulk (WP 4.7+)', 'duplicate-post').' — '.esc_html__('Wildcards in custom field names', 'duplicate-post').' — '.esc_html__('Options for thumbnail, post format, post template, author, menu order', 'duplicate-post').'</em><br/>';
141
- $message .= sprintf(__('Please <a href="%s">review the settings</a> to make sure it works as you expect.', 'duplicate-post'), admin_url('options-general.php?page=duplicatepost')).'<br/>';
142
- $message .= '<strong>'.__('Help me develop the plugin and provide support by <a href="http://lopo.it/duplicate-post-plugin">donating even a small sum</a>.', 'duplicate-post').'</strong>';
143
- global $wp_version;
144
- if( version_compare($wp_version, '4.2') < 0 ){
145
- $message .= ' | <a id="duplicate-post-dismiss-notice" href="javascript:duplicate_post_dismiss_notice();">'.__('Dismiss this notice.').'</a>';
146
- }
147
- echo '<div id="duplicate-post-notice" class="'.$class.'"><p>'.$message.'</p></div>';
148
- echo "<script>
149
- function duplicate_post_dismiss_notice(){
150
- var data = {
151
- 'action': 'duplicate_post_dismiss_notice',
152
- };
153
-
154
- jQuery.post(ajaxurl, data, function(response) {
155
- jQuery('#duplicate-post-notice').hide();
156
- });
157
- }
158
 
159
- jQuery(document).ready(function(){
160
- jQuery('body').on('click', '.notice-dismiss', function(){
161
- duplicate_post_dismiss_notice();
162
- });
163
  });
164
- </script>";
165
- }
 
166
 
167
- if(is_multisite()){
168
- add_action( 'network_admin_notices', 'duplicate_post_show_update_notice' );
169
- } else {
170
- add_action( 'admin_notices', 'duplicate_post_show_update_notice' );
171
- }
172
- add_action( 'wp_ajax_duplicate_post_dismiss_notice', 'duplicate_post_dismiss_notice' );
173
-
174
- function duplicate_post_dismiss_notice() {
175
- $result = update_site_option('duplicate_post_show_notice', 0);
176
- return $result;
177
- wp_die();
178
- }
179
  }
180
 
181
  /**
@@ -196,10 +242,6 @@ function duplicate_post_make_duplicate_link_row($actions, $post) {
196
  /**
197
  * Add a button in the post/page edit screen to create a clone
198
  */
199
- if (get_option('duplicate_post_show_submitbox') == 1){
200
- add_action( 'post_submitbox_start', 'duplicate_post_add_duplicate_post_button' );
201
- }
202
-
203
  function duplicate_post_add_duplicate_post_button() {
204
  if ( isset( $_GET['post'] )){
205
  $id = $_GET['post'];
@@ -216,12 +258,6 @@ function duplicate_post_add_duplicate_post_button() {
216
  }
217
  }
218
 
219
- /**
220
- * Connect actions to functions
221
- */
222
- add_action('admin_action_duplicate_post_save_as_new_post', 'duplicate_post_save_as_new_post');
223
- add_action('admin_action_duplicate_post_save_as_new_post_draft', 'duplicate_post_save_as_new_post_draft');
224
-
225
  /*
226
  * This function calls the creation of a new copy of the selected post (as a draft)
227
  * then redirects to the edit post screen
@@ -230,8 +266,6 @@ function duplicate_post_save_as_new_post_draft(){
230
  duplicate_post_save_as_new_post('draft');
231
  }
232
 
233
- add_filter('removable_query_args', 'duplicate_post_add_removable_query_arg', 10, 1);
234
-
235
  function duplicate_post_add_removable_query_arg( $removable_query_args ){
236
  $removable_query_args[] = 'cloned';
237
  return $removable_query_args;
@@ -248,14 +282,31 @@ function duplicate_post_save_as_new_post($status = ''){
248
 
249
  // Get the original post
250
  $id = (isset($_GET['post']) ? $_GET['post'] : $_POST['post']);
251
- $post = get_post($id);
 
 
 
252
 
253
  // Copy the post and insert it
254
  if (isset($post) && $post!=null) {
255
  $new_id = duplicate_post_create_duplicate($post, $status);
256
 
257
  if ($status == ''){
258
- $sendback = remove_query_arg( array( 'trashed', 'untrashed', 'deleted', 'cloned', 'ids'), admin_url( 'edit.php?post_type='.$post->post_type) );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
259
  // Redirect to the post list screen
260
  wp_redirect( add_query_arg( array( 'cloned' => 1, 'ids' => $post->ID), $sendback ) );
261
  } else {
@@ -279,7 +330,7 @@ function duplicate_post_copy_post_taxonomies($new_id, $post) {
279
  wp_set_object_terms( $new_id, NULL, 'category' );
280
 
281
  $post_taxonomies = get_object_taxonomies($post->post_type);
282
- // severl plugins just add support to post-formats but don't register post_format taxonomy
283
  if(post_type_supports($post->post_type, 'post-formats') && !in_array('post_format', $post_taxonomies)){
284
  $post_taxonomies[] = 'post_format';
285
  }
@@ -315,9 +366,6 @@ function duplicate_post_copy_post_meta_info($new_id, $post) {
315
  $meta_blacklist = array_filter($meta_blacklist);
316
  $meta_blacklist = array_map('trim', $meta_blacklist);
317
  }
318
- $meta_blacklist[] = '_wpas_done_all'; //Jetpack Publicize
319
- $meta_blacklist[] = '_wpas_done_'; //Jetpack Publicize
320
- $meta_blacklist[] = '_wpas_mess'; //Jetpack Publicize
321
  $meta_blacklist[] = '_edit_lock'; // edit lock
322
  $meta_blacklist[] = '_edit_last'; // edit lock
323
  if(get_option('duplicate_post_copytemplate') == 0){
@@ -429,13 +477,13 @@ function duplicate_post_copy_attachments($new_id, $post){
429
  /**
430
  * Copy children posts
431
  */
432
- function duplicate_post_copy_children($new_id, $post){
433
  // get children
434
  $children = get_posts(array( 'post_type' => 'any', 'numberposts' => -1, 'post_status' => 'any', 'post_parent' => $post->ID ));
435
  // clone old attachments
436
  foreach($children as $child){
437
  if ($child->post_type == 'attachment') continue;
438
- duplicate_post_create_duplicate($child, '', $new_id);
439
  }
440
  }
441
 
@@ -477,29 +525,6 @@ function duplicate_post_copy_comments($new_id, $post){
477
  }
478
  }
479
 
480
- // Using our action hooks
481
-
482
- add_action('dp_duplicate_post', 'duplicate_post_copy_post_meta_info', 10, 2);
483
- add_action('dp_duplicate_page', 'duplicate_post_copy_post_meta_info', 10, 2);
484
-
485
- if(get_option('duplicate_post_copychildren') == 1){
486
- add_action('dp_duplicate_post', 'duplicate_post_copy_children', 20, 2);
487
- add_action('dp_duplicate_page', 'duplicate_post_copy_children', 20, 2);
488
- }
489
-
490
- if(get_option('duplicate_post_copyattachments') == 1){
491
- add_action('dp_duplicate_post', 'duplicate_post_copy_attachments', 30, 2);
492
- add_action('dp_duplicate_page', 'duplicate_post_copy_attachments', 30, 2);
493
- }
494
-
495
- if(get_option('duplicate_post_copycomments') == 1){
496
- add_action('dp_duplicate_post', 'duplicate_post_copy_comments', 40, 2);
497
- add_action('dp_duplicate_page', 'duplicate_post_copy_comments', 40, 2);
498
- }
499
-
500
- add_action('dp_duplicate_post', 'duplicate_post_copy_post_taxonomies', 50, 2);
501
- add_action('dp_duplicate_page', 'duplicate_post_copy_post_taxonomies', 50, 2);
502
-
503
  /**
504
  * Create a duplicate from a post
505
  */
@@ -610,9 +635,9 @@ function duplicate_post_create_duplicate($post, $status = '', $parent_id = '') {
610
  // If you have written a plugin which uses non-WP database tables to save
611
  // information about a post you can hook this action to dupe that data.
612
  if ($post->post_type == 'page' || is_post_type_hierarchical( $post->post_type ))
613
- do_action( 'dp_duplicate_page', $new_post_id, $post );
614
  else
615
- do_action( 'dp_duplicate_post', $new_post_id, $post );
616
 
617
  delete_post_meta($new_post_id, '_dp_original');
618
  add_post_meta($new_post_id, '_dp_original', $post->ID);
@@ -623,20 +648,15 @@ function duplicate_post_create_duplicate($post, $status = '', $parent_id = '') {
623
  }
624
 
625
  //Add some links on the plugin page
626
- add_filter('plugin_row_meta', 'duplicate_post_add_plugin_links', 10, 2);
627
-
628
  function duplicate_post_add_plugin_links($links, $file) {
629
  if ( $file == plugin_basename(dirname(__FILE__).'/duplicate-post.php') ) {
630
- $links[] = '<a href="http://lopo.it/duplicate-post-plugin">' . esc_html__('Donate', 'duplicate-post') . '</a>';
631
- $links[] = '<a href="https://translate.wordpress.org/projects/wp-plugins/duplicate-post">' . esc_html__('Translate', 'duplicate-post') . '</a>';
632
  }
633
  return $links;
634
  }
635
 
636
  /*** NOTICES ***/
637
-
638
- add_action( 'admin_notices', 'duplicate_post_action_admin_notice' );
639
-
640
  function duplicate_post_action_admin_notice() {
641
  if ( ! empty( $_REQUEST['cloned'] ) ) {
642
  $copied_posts = intval( $_REQUEST['cloned'] );
@@ -652,7 +672,6 @@ function duplicate_post_action_admin_notice() {
652
 
653
 
654
  /*** BULK ACTIONS ***/
655
-
656
  add_action('admin_init', 'duplicate_post_add_bulk_filters_for_enabled_post_types');
657
 
658
  function duplicate_post_add_bulk_filters_for_enabled_post_types(){
5
 
6
  require_once (dirname(__FILE__).'/duplicate-post-options.php');
7
 
8
+ require_once (dirname(__FILE__).'/compat/duplicate-post-wpml.php');
9
+ require_once (dirname(__FILE__).'/compat/duplicate-post-jetpack.php');
10
+
11
  /**
12
  * Wrapper for the option 'duplicate_post_version'
13
  */
22
  return DUPLICATE_POST_CURRENT_VERSION;
23
  }
24
 
25
+
26
+ add_action('admin_init','duplicate_post_admin_init');
27
+
28
+ function duplicate_post_admin_init(){
29
+ duplicate_post_plugin_upgrade();
30
+
31
+ if (get_option('duplicate_post_show_row') == 1){
32
+ add_filter('post_row_actions', 'duplicate_post_make_duplicate_link_row',10,2);
33
+ add_filter('page_row_actions', 'duplicate_post_make_duplicate_link_row',10,2);
34
+ }
35
+
36
+ if (get_site_option('duplicate_post_show_notice') == 1){
37
+ if(is_multisite()){
38
+ add_action( 'network_admin_notices', 'duplicate_post_show_update_notice' );
39
+ } else {
40
+ add_action( 'admin_notices', 'duplicate_post_show_update_notice' );
41
+ }
42
+ add_action( 'wp_ajax_duplicate_post_dismiss_notice', 'duplicate_post_dismiss_notice' );
43
+ }
44
+
45
+ if (get_option('duplicate_post_show_submitbox') == 1){
46
+ add_action( 'post_submitbox_start', 'duplicate_post_add_duplicate_post_button' );
47
+ }
48
+
49
+ /**
50
+ * Connect actions to functions
51
+ */
52
+ add_action('admin_action_duplicate_post_save_as_new_post', 'duplicate_post_save_as_new_post');
53
+ add_action('admin_action_duplicate_post_save_as_new_post_draft', 'duplicate_post_save_as_new_post_draft');
54
+
55
+ add_filter('removable_query_args', 'duplicate_post_add_removable_query_arg', 10, 1);
56
+
57
+ // Using our action hooks
58
+
59
+ add_action('dp_duplicate_post', 'duplicate_post_copy_post_meta_info', 10, 2);
60
+ add_action('dp_duplicate_page', 'duplicate_post_copy_post_meta_info', 10, 2);
61
+
62
+ if(get_option('duplicate_post_copychildren') == 1){
63
+ add_action('dp_duplicate_post', 'duplicate_post_copy_children', 20, 3);
64
+ add_action('dp_duplicate_page', 'duplicate_post_copy_children', 20, 3);
65
+ }
66
+
67
+ if(get_option('duplicate_post_copyattachments') == 1){
68
+ add_action('dp_duplicate_post', 'duplicate_post_copy_attachments', 30, 2);
69
+ add_action('dp_duplicate_page', 'duplicate_post_copy_attachments', 30, 2);
70
+ }
71
+
72
+ if(get_option('duplicate_post_copycomments') == 1){
73
+ add_action('dp_duplicate_post', 'duplicate_post_copy_comments', 40, 2);
74
+ add_action('dp_duplicate_page', 'duplicate_post_copy_comments', 40, 2);
75
+ }
76
+
77
+ add_action('dp_duplicate_post', 'duplicate_post_copy_post_taxonomies', 50, 2);
78
+ add_action('dp_duplicate_page', 'duplicate_post_copy_post_taxonomies', 50, 2);
79
+
80
+ add_filter('plugin_row_meta', 'duplicate_post_add_plugin_links', 10, 2);
81
+
82
+ add_action( 'admin_notices', 'duplicate_post_action_admin_notice' );
83
+ }
84
+
85
+
86
  /**
87
  * Plugin upgrade
88
  */
 
 
89
  function duplicate_post_plugin_upgrade() {
90
  $installed_version = duplicate_post_get_installed_version();
91
 
185
 
186
  }
187
 
188
+ /**
189
+ * Shows the update notice
190
+ */
191
+ function duplicate_post_show_update_notice() {
192
+ if(!current_user_can( 'manage_options')) return;
193
+ $class = 'notice is-dismissible';
194
+ $message = '<strong><a href="https://duplicate-post.lopo.it/">'.esc_html__('Check out the new documentation for Duplicate Post!', 'duplicate-post').'</a></strong><br/>';
195
+ $message .= '<em>'.esc_html__('Duplicate Post is now also compatible with WPML!', 'duplicate-post').'</em><br/>';
196
+ $message .= '<strong>'.sprintf(wp_kses(__('Help me develop the plugin and provide support by <a href="%s">donating even a small sum</a>.', 'duplicate-post'), array( 'a' => array( 'href' => array() ) ) ), "https://duplicate-post.lopo.it/donate").'</strong>';
197
+ global $wp_version;
198
+ if( version_compare($wp_version, '4.2') < 0 ){
199
+ $message .= ' | <a id="duplicate-post-dismiss-notice" href="javascript:duplicate_post_dismiss_notice();">'.__('Dismiss this notice.').'</a>';
200
+ }
201
+ echo '<div id="duplicate-post-notice" class="'.$class.'"><p>'.$message.'</p></div>';
202
+ echo "<script>
203
+ function duplicate_post_dismiss_notice(){
204
+ var data = {
205
+ 'action': 'duplicate_post_dismiss_notice',
206
+ };
207
+
208
+ jQuery.post(ajaxurl, data, function(response) {
209
+ jQuery('#duplicate-post-notice').hide();
210
+ });
211
+ }
 
 
 
 
 
 
 
 
212
 
213
+ jQuery(document).ready(function(){
214
+ jQuery('body').on('click', '.notice-dismiss', function(){
215
+ duplicate_post_dismiss_notice();
 
216
  });
217
+ });
218
+ </script>";
219
+ }
220
 
221
+ function duplicate_post_dismiss_notice() {
222
+ $result = update_site_option('duplicate_post_show_notice', 0);
223
+ return $result;
224
+ wp_die();
 
 
 
 
 
 
 
 
225
  }
226
 
227
  /**
242
  /**
243
  * Add a button in the post/page edit screen to create a clone
244
  */
 
 
 
 
245
  function duplicate_post_add_duplicate_post_button() {
246
  if ( isset( $_GET['post'] )){
247
  $id = $_GET['post'];
258
  }
259
  }
260
 
 
 
 
 
 
 
261
  /*
262
  * This function calls the creation of a new copy of the selected post (as a draft)
263
  * then redirects to the edit post screen
266
  duplicate_post_save_as_new_post('draft');
267
  }
268
 
 
 
269
  function duplicate_post_add_removable_query_arg( $removable_query_args ){
270
  $removable_query_args[] = 'cloned';
271
  return $removable_query_args;
282
 
283
  // Get the original post
284
  $id = (isset($_GET['post']) ? $_GET['post'] : $_POST['post']);
285
+
286
+ check_admin_referer('duplicate-post_' . $id);
287
+
288
+ $post = get_post($id);
289
 
290
  // Copy the post and insert it
291
  if (isset($post) && $post!=null) {
292
  $new_id = duplicate_post_create_duplicate($post, $status);
293
 
294
  if ($status == ''){
295
+ $sendback = wp_get_referer();
296
+ if ( ! $sendback ||
297
+ strpos( $sendback, 'post.php' ) !== false ||
298
+ strpos( $sendback, 'post-new.php' ) !== false ) {
299
+ if ( 'attachment' == $post_type ) {
300
+ $sendback = admin_url( 'upload.php' );
301
+ } else {
302
+ $sendback = admin_url( 'edit.php' );
303
+ if ( ! empty( $post_type ) ) {
304
+ $sendback = add_query_arg( 'post_type', $post_type, $sendback );
305
+ }
306
+ }
307
+ } else {
308
+ $sendback = remove_query_arg( array('trashed', 'untrashed', 'deleted', 'cloned', 'ids'), $sendback );
309
+ }
310
  // Redirect to the post list screen
311
  wp_redirect( add_query_arg( array( 'cloned' => 1, 'ids' => $post->ID), $sendback ) );
312
  } else {
330
  wp_set_object_terms( $new_id, NULL, 'category' );
331
 
332
  $post_taxonomies = get_object_taxonomies($post->post_type);
333
+ // several plugins just add support to post-formats but don't register post_format taxonomy
334
  if(post_type_supports($post->post_type, 'post-formats') && !in_array('post_format', $post_taxonomies)){
335
  $post_taxonomies[] = 'post_format';
336
  }
366
  $meta_blacklist = array_filter($meta_blacklist);
367
  $meta_blacklist = array_map('trim', $meta_blacklist);
368
  }
 
 
 
369
  $meta_blacklist[] = '_edit_lock'; // edit lock
370
  $meta_blacklist[] = '_edit_last'; // edit lock
371
  if(get_option('duplicate_post_copytemplate') == 0){
477
  /**
478
  * Copy children posts
479
  */
480
+ function duplicate_post_copy_children($new_id, $post, $status = ''){
481
  // get children
482
  $children = get_posts(array( 'post_type' => 'any', 'numberposts' => -1, 'post_status' => 'any', 'post_parent' => $post->ID ));
483
  // clone old attachments
484
  foreach($children as $child){
485
  if ($child->post_type == 'attachment') continue;
486
+ duplicate_post_create_duplicate($child, $status, $new_id);
487
  }
488
  }
489
 
525
  }
526
  }
527
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
528
  /**
529
  * Create a duplicate from a post
530
  */
635
  // If you have written a plugin which uses non-WP database tables to save
636
  // information about a post you can hook this action to dupe that data.
637
  if ($post->post_type == 'page' || is_post_type_hierarchical( $post->post_type ))
638
+ do_action( 'dp_duplicate_page', $new_post_id, $post, $status );
639
  else
640
+ do_action( 'dp_duplicate_post', $new_post_id, $post, $status );
641
 
642
  delete_post_meta($new_post_id, '_dp_original');
643
  add_post_meta($new_post_id, '_dp_original', $post->ID);
648
  }
649
 
650
  //Add some links on the plugin page
 
 
651
  function duplicate_post_add_plugin_links($links, $file) {
652
  if ( $file == plugin_basename(dirname(__FILE__).'/duplicate-post.php') ) {
653
+ $links[] = '<a href="https://duplicate-post.lopo.it/">' . esc_html__('Documentation', 'duplicate-post') . '</a>';
654
+ $links[] = '<a href="https://duplicate-post.lopo.it/donate">' . esc_html__('Donate', 'duplicate-post') . '</a>';
655
  }
656
  return $links;
657
  }
658
 
659
  /*** NOTICES ***/
 
 
 
660
  function duplicate_post_action_admin_notice() {
661
  if ( ! empty( $_REQUEST['cloned'] ) ) {
662
  $copied_posts = intval( $_REQUEST['cloned'] );
672
 
673
 
674
  /*** BULK ACTIONS ***/
 
675
  add_action('admin_init', 'duplicate_post_add_bulk_filters_for_enabled_post_types');
676
 
677
  function duplicate_post_add_bulk_filters_for_enabled_post_types(){
duplicate-post-common.php CHANGED
@@ -57,7 +57,7 @@ function duplicate_post_get_clone_post_link( $id = 0, $context = 'display', $dra
57
  if ( !$post_type_object )
58
  return;
59
 
60
- return apply_filters( 'duplicate_post_get_clone_post_link', admin_url( "admin.php". $action ), $post->ID, $context );
61
  }
62
  /**
63
  * Display duplicate post link for post.
@@ -85,12 +85,12 @@ function duplicate_post_clone_post_link( $link = null, $before = '', $after = ''
85
  /**
86
  * Get original post .
87
  *
88
- * @param int $id Optional. Post ID.
89
  * @param string $output Optional, default is Object. Either OBJECT, ARRAY_A, or ARRAY_N.
90
  * @return mixed Post data
91
  */
92
- function duplicate_post_get_original($id = 0 , $output = OBJECT){
93
- if ( !$post = get_post( $id ) )
94
  return;
95
  $original_ID = get_post_meta( $post->ID, '_dp_original');
96
  if (empty($original_ID)) return null;
@@ -134,9 +134,14 @@ function duplicate_post_add_css() {
134
  }
135
  }
136
 
137
- if (get_option ( 'duplicate_post_show_adminbar' ) == 1) {
138
- add_action ( 'wp_before_admin_bar_render', 'duplicate_post_admin_bar_render' );
139
- add_action ( 'wp_enqueue_scripts', 'duplicate_post_add_css' );
 
 
 
 
 
140
  }
141
 
142
  /**
57
  if ( !$post_type_object )
58
  return;
59
 
60
+ return wp_nonce_url(apply_filters( 'duplicate_post_get_clone_post_link', admin_url( "admin.php". $action ), $post->ID, $context ), 'duplicate-post_' . $post->ID);
61
  }
62
  /**
63
  * Display duplicate post link for post.
85
  /**
86
  * Get original post .
87
  *
88
+ * @param int $post Optional. Post ID or Post object.
89
  * @param string $output Optional, default is Object. Either OBJECT, ARRAY_A, or ARRAY_N.
90
  * @return mixed Post data
91
  */
92
+ function duplicate_post_get_original($post = null , $output = OBJECT){
93
+ if ( !$post = get_post( $post ) )
94
  return;
95
  $original_ID = get_post_meta( $post->ID, '_dp_original');
96
  if (empty($original_ID)) return null;
134
  }
135
  }
136
 
137
+
138
+ add_action('init', 'duplicate_post_init');
139
+
140
+ function duplicate_post_init(){
141
+ if (get_option ( 'duplicate_post_show_adminbar' ) == 1) {
142
+ add_action ( 'wp_before_admin_bar_render', 'duplicate_post_admin_bar_render' );
143
+ add_action ( 'wp_enqueue_scripts', 'duplicate_post_add_css' );
144
+ }
145
  }
146
 
147
  /**
duplicate-post-options.php CHANGED
@@ -7,8 +7,8 @@ if ( !defined( 'ABSPATH' ) ) {
7
  }
8
 
9
  if ( is_admin() ){ // admin actions
10
- add_action('admin_menu', 'duplicate_post_menu');
11
- add_action( 'admin_init', 'duplicate_post_register_settings');
12
  }
13
 
14
  function duplicate_post_register_settings() { // whitelist options
@@ -86,11 +86,10 @@ function duplicate_post_options() {
86
  <br/>
87
  <?php esc_html_e('Donate whatever sum you choose, even just 10¢.', 'duplicate-post'); ?>
88
  <br/>
89
- <a href="http://lopo.it/duplicate-post-plugin"><img id="donate-button" style="margin: 0px auto;" src="<?php echo plugins_url( 'donate.png', __FILE__ ); ?>" alt="Donate"/></a>
90
  <br/>
91
- <a href="http://lopo.it/duplicate-post-plugin"><?php esc_html_e('Visit plugin site'); ?></a>
92
- - <a href="https://translate.wordpress.org/projects/wp-plugins/duplicate-post"><?php esc_html_e('Translate', 'duplicate-post'); ?></a>
93
- - <a href="https://wordpress.org/plugins/duplicate-post/faq/"><?php esc_html_e('FAQ', 'duplicate-post'); ?></a>
94
  - <a href="https://wordpress.org/support/plugin/duplicate-post"><?php esc_html_e('Support Forum', 'duplicate-post'); ?></a>
95
  </p>
96
  </div>
@@ -233,13 +232,13 @@ img#donate-button{
233
  <?php esc_html_e("Password", 'default'); ?>
234
  </label> <label> <input type="checkbox"
235
  name="duplicate_post_copyattachments" value="1" <?php if(get_option('duplicate_post_copyattachments') == 1) echo 'checked="checked"'; ?>"/>
236
- <?php esc_html_e("Attachments", 'duplicate-post'); ?>
237
  </label> <label> <input type="checkbox"
238
  name="duplicate_post_copychildren" value="1" <?php if(get_option('duplicate_post_copychildren') == 1) echo 'checked="checked"'; ?>"/>
239
  <?php esc_html_e("Children", 'duplicate-post'); ?>
240
  </label> <label> <input type="checkbox"
241
  name="duplicate_post_copycomments" value="1" <?php if(get_option('duplicate_post_copycomments') == 1) echo 'checked="checked"'; ?>"/>
242
- <?php esc_html_e("Comments", 'default'); ?> (<?php esc_html_e("except pingbacks and trackbacks", 'duplicate-post'); ?>)
243
  </label> <label> <input type="checkbox"
244
  name="duplicate_post_copymenuorder" value="1" <?php if(get_option('duplicate_post_copymenuorder') == 1) echo 'checked="checked"'; ?>"/>
245
  <?php esc_html_e("Menu order", 'default'); ?>
7
  }
8
 
9
  if ( is_admin() ){ // admin actions
10
+ add_action( 'admin_menu', 'duplicate_post_menu' );
11
+ add_action( 'admin_init', 'duplicate_post_register_settings' );
12
  }
13
 
14
  function duplicate_post_register_settings() { // whitelist options
86
  <br/>
87
  <?php esc_html_e('Donate whatever sum you choose, even just 10¢.', 'duplicate-post'); ?>
88
  <br/>
89
+ <a href="https://duplicate-post.lopo.it/donate"><img id="donate-button" style="margin: 0px auto;" src="<?php echo plugins_url( 'donate.png', __FILE__ ); ?>" alt="Donate"/></a>
90
  <br/>
91
+ <a href="https://duplicate-post.lopo.it/"><?php esc_html_e('Documentation', 'duplicate-post'); ?></a>
92
+ - <a href="https://translate.wordpress.org/projects/wp-plugins/duplicate-post"><?php esc_html_e('Translate', 'duplicate-post'); ?></a>
 
93
  - <a href="https://wordpress.org/support/plugin/duplicate-post"><?php esc_html_e('Support Forum', 'duplicate-post'); ?></a>
94
  </p>
95
  </div>
232
  <?php esc_html_e("Password", 'default'); ?>
233
  </label> <label> <input type="checkbox"
234
  name="duplicate_post_copyattachments" value="1" <?php if(get_option('duplicate_post_copyattachments') == 1) echo 'checked="checked"'; ?>"/>
235
+ <?php esc_html_e("Attachments", 'duplicate-post'); ?> <small>(<?php esc_html_e("you probably want this unchecked, unless you have very special requirements", 'duplicate-post'); ?>)</small>
236
  </label> <label> <input type="checkbox"
237
  name="duplicate_post_copychildren" value="1" <?php if(get_option('duplicate_post_copychildren') == 1) echo 'checked="checked"'; ?>"/>
238
  <?php esc_html_e("Children", 'duplicate-post'); ?>
239
  </label> <label> <input type="checkbox"
240
  name="duplicate_post_copycomments" value="1" <?php if(get_option('duplicate_post_copycomments') == 1) echo 'checked="checked"'; ?>"/>
241
+ <?php esc_html_e("Comments", 'default'); ?> <small>(<?php esc_html_e("except pingbacks and trackbacks", 'duplicate-post'); ?>)</small>
242
  </label> <label> <input type="checkbox"
243
  name="duplicate_post_copymenuorder" value="1" <?php if(get_option('duplicate_post_copymenuorder') == 1) echo 'checked="checked"'; ?>"/>
244
  <?php esc_html_e("Menu order", 'default'); ?>
duplicate-post.css CHANGED
@@ -1,5 +1,5 @@
1
  #wpadminbar #wp-admin-bar-new_draft > .ab-item::before {
2
- content: "\f498\f344\f498";
3
  top: 2px;
4
  }
5
 
1
  #wpadminbar #wp-admin-bar-new_draft > .ab-item::before {
2
+ content: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 20 20'><path d='M18.9 4.3c0.6 0 1.1 0.5 1.1 1.1v13.6c0 0.6-0.5 1.1-1.1 1.1h-10.7c-0.6 0-1.1-0.5-1.1-1.1v-3.2h-6.1c-0.6 0-1.1-0.5-1.1-1.1v-7.5c0-0.6 0.3-1.4 0.8-1.8l4.6-4.6c0.4-0.4 1.2-0.8 1.8-0.8h4.6c0.6 0 1.1 0.5 1.1 1.1v3.7c0.4-0.3 1-0.4 1.4-0.4h4.6zM12.9 6.7l-3.3 3.3h3.3v-3.3zM5.7 2.4l-3.3 3.3h3.3v-3.3zM7.9 9.6l3.5-3.5v-4.6h-4.3v4.6c0 0.6-0.5 1.1-1.1 1.1h-4.6v7.1h5.7v-2.9c0-0.6 0.3-1.4 0.8-1.8zM18.6 18.6v-12.9h-4.3v4.6c0 0.6-0.5 1.1-1.1 1.1h-4.6v7.1h10z' fill='rgba(240,245,250,.6)'/></svg>");
3
  top: 2px;
4
  }
5
 
duplicate-post.php CHANGED
@@ -1,11 +1,11 @@
1
  <?php
2
  /*
3
  Plugin Name: Duplicate Post
4
- Plugin URI: http://lopo.it/duplicate-post-plugin/
5
  Description: Clone posts and pages.
6
- Version: 3.1.2
7
  Author: Enrico Battocchi
8
- Author URI: http://lopo.it
9
  Text Domain: duplicate-post
10
  */
11
 
@@ -31,7 +31,7 @@ if ( ! defined( 'ABSPATH' ) ) {
31
  }
32
 
33
  // Version of the plugin
34
- define('DUPLICATE_POST_CURRENT_VERSION', '3.1.2' );
35
 
36
 
37
  /**
1
  <?php
2
  /*
3
  Plugin Name: Duplicate Post
4
+ Plugin URI: https://duplicate-post.lopo.it/
5
  Description: Clone posts and pages.
6
+ Version: 3.2
7
  Author: Enrico Battocchi
8
+ Author URI: https://lopo.it
9
  Text Domain: duplicate-post
10
  */
11
 
31
  }
32
 
33
  // Version of the plugin
34
+ define('DUPLICATE_POST_CURRENT_VERSION', '3.2' );
35
 
36
 
37
  /**
readme.txt CHANGED
@@ -1,20 +1,19 @@
1
  === Duplicate Post ===
2
  Contributors: lopo
3
- Donate link: https://lopo.it/duplicate-post-plugin/
4
  Tags: duplicate post, copy, clone
5
  Requires at least: 3.6
6
- Tested up to: 4.7
7
- Stable tag: 3.1.2
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
11
- Clone posts and pages.
12
 
13
  == Description ==
14
 
15
- This plugin allows to clone a post or page, or edit it as a new draft.
16
- If you find this useful, [**please consider donating**](https://lopo.it/duplicate-post-plugin/) whatever sum you choose, **even just 10 cents**. It's been downloaded thousands of times: just a few cents from every user would help me develop the plugin and improve support.
17
-
18
 
19
  How it works:
20
 
@@ -32,13 +31,9 @@ How it works:
32
 
33
  There is also a **template tag**, so you can put it in your templates and clone your posts/pages from the front-end. Clicking on the link will lead you to the edit page for the new draft, just like the admin bar link.
34
 
35
- In the Options page under Settings it is now possible to choose what to copy, and you can also set a prefix (or a suffix) to place before (or after) the title of the cloned post/page.
36
-
37
- You can also restrict the plugin to certain post types, and allow only some roles to clone posts or pages.
38
-
39
- If you want to contribute to translate the plugin in languages other than English, there is a [translation project](https://translate.wordpress.org/projects/wp-plugins/duplicate-post) available: [contact me](https://lopo.it/contatti/) if you wish to become an editor for your language.
40
 
41
- **If you're a plugin developer**, I suggest to read the section made just for you under "Other Notes", to ensure compatibility between your plugin(s) and mine.
42
 
43
  Thanks for all the suggestions, bug reports, translations and donations, they're frankly too many to be listed here!
44
 
@@ -57,20 +52,18 @@ Use WordPress' Add New Plugin feature, searching "Duplicate Post", or download t
57
 
58
  First, check your version of WordPress: the plugin is not supposed to work on old versions anymore. Make sure also to upgrade to the last version of the plugin!
59
 
60
- Then try to deactivate and re-activate it, some user have reported that this fixes the problem.
61
 
62
- Pay also attention to the new "Roles allowed to copy" option: it should convert the former "user level" option to the new standard, but unknown problems may arise. Make sure that your role is enabled.
63
 
64
- From version 3.0 onwards, post types must be enabled in the Options: check them as well.
65
-
66
- If not, maybe there is some kind of conflict with other plugins: feel free [to write me](https://lopo.it/contatti/) and we'll try to discover a solution (it will be *really* helpful if you try to deactivate all your other plugins one by one to see which one conflicts with mine... But do it only if you know what you're doing, I will not be responsible of any problem you may experience).
67
 
68
  = The plugin is not translated in my language! =
69
 
70
  From version 3.0 the plugin's translations are managed by the WordPress.org platform and the plugin is shipped without language files, so first of all update translations under Dashboard->Updates.
71
 
72
  If Duplicate Post is still in English, or if there are some untraslated strings, you can help traslating to your language [here](https://translate.wordpress.org/projects/wp-plugins/duplicate-post): you only need a WordPress.org account.
73
- [Contact me](https://lopo.it/contatti/) if you wish to become an editor for your language.
74
 
75
  == Screenshots ==
76
 
@@ -83,6 +76,9 @@ If Duplicate Post is still in English, or if there are some untraslated strings,
83
 
84
  == Upgrade Notice ==
85
 
 
 
 
86
  = 3.1.2 =
87
  Fixes the problem with custom fields
88
 
@@ -142,13 +138,21 @@ New features and customization, WP 3.0 compatibility: you should upgrade if you
142
 
143
  == Changelog ==
144
 
145
- = 3.1.2 =
 
 
 
 
 
 
 
 
146
  * Fix for custom fields not copied
147
 
148
- = 3.1.1 =
149
  * Fix for nasty update nag (plus a failsafe checkbox)
150
 
151
- = 3.1 =
152
  * Bulk clone action added (WP 4.7+)
153
  * Wildcards enabled for custom fields to skip
154
  * Options to copy post author, post format (moved from taxonomies), menu order, post template
@@ -158,22 +162,22 @@ New features and customization, WP 3.0 compatibility: you should upgrade if you
158
  * Probable fix for repeated clone bug
159
  * Other minor bugs fixed
160
 
161
- = 3.0.3 =
162
  * Notices in admin after copying
163
  * Fixes warning in custom post type archives
164
  * Uses site options for version and notice
165
  * Minor fixes
166
 
167
- = 3.0.2 =
168
  * Can now be enabled for every custom post type with visible UI (not just public ones)
169
  * Admin bar CSS only enqueued when needed
170
  * New "Donate" button
171
  * Fixes for minor bugs and typos
172
 
173
- = 3.0.1 =
174
  * Fixes the issues for people upgrading from an older version
175
 
176
- = 3.0 =
177
  * Settings page redesigned
178
  * More options to enable/disable copy of every part of a post
179
  * Enable/disable cloning for every custom post type
@@ -183,40 +187,40 @@ New features and customization, WP 3.0 compatibility: you should upgrade if you
183
  * Translations removed to use WP.org's official translation project
184
  * Checked PHP 7 compatibility
185
 
186
- = 2.6 =
187
  * PHP 5.4 (Strict Standards) compatible
188
  * Fixed possible XSS and SQL injections
189
  * other bugs
190
  * Updated and added translations
191
  * Tested up to WP 3.8.1
192
 
193
- = 2.4.1 =
194
  * Fixed regression about draft permalinks
195
  * Fixed bug with guid
196
  * Don't clone to_ping and pinged (maybe there will be an option about those later)
197
 
198
- = 2.4 =
199
  * New option to clone the children of the original page
200
  * Licence changed to GPLv2 or later
201
  * Fixed publishing dates for drafts
202
  * Fixed bug with prefix/suffix
203
  * Translation project moved to GlotPress
204
 
205
- = 2.3 =
206
  * Added options to choose where to show the "Clone" links
207
  * Clone attachments (i.e. references in the DB, not physical files)
208
  * Fix for untranslated user roles
209
  * Some other fixes (missing checks, PHP warnings and errors, etc.)
210
 
211
- = 2.2 =
212
  * Fix for problems when copying serialized meta fields
213
  * Fix for multiple _dp_original field
214
  * Removed deprecated parameter when adding options
215
 
216
- = 2.1.1 =
217
  * Can't rely on activation hook for upgrade, this caused problems with new options
218
 
219
- = 2.1 =
220
  * Even more code cleaning (no more custom queries, using WP API)
221
  * Term order preserved when copying
222
  * Stopped using deprecated User levels, now it uses Roles and Capabilities
@@ -224,16 +228,16 @@ New features and customization, WP 3.0 compatibility: you should upgrade if you
224
  * duplicate_post_get_original template tag
225
  * Settings link in plugin list, 'Donate' and 'Translate' link in option page
226
 
227
- = 2.0.2 =
228
  * Fixed bug for permalinks
229
  * Two links on posts list: clone immediately or copy to a new draft to edit.
230
  * Tested on multisite mode.
231
 
232
- = 2.0.1 =
233
  * Fixed bug for action filters
234
  * New option so you can choose if cloning from the posts list must copy the post status (draft, published, pending) too.
235
 
236
- = 2.0 =
237
  * WP 3.3 compatibility (still not tested against multiblog feature, so beware)
238
  * Minimum WP version: 3.0
239
  * Code cleanup
@@ -242,88 +246,49 @@ New features and customization, WP 3.0 compatibility: you should upgrade if you
242
  * Added suffix option
243
  * Added template tag
244
 
245
- = 1.1.2 =
246
  * WP 3.1.1 compatibility (still not tested against multiblog feature, so beware)
247
  * Added complete Polish language files
248
 
249
- = 1.1.1 =
250
  * Plugin split in two files for faster opening in Plugins list page
251
  * fix conflicts with a few other plugins
252
  * Added Dutch language files
253
 
254
- = 1.1 =
255
  * WP 3.0 compatibility (not tested against multiblog feature, so beware)
256
  * Option page: minimum user level, title prefix, fields not to be copied, copy post/page date also
257
  * Added German, Swedish, Romanian, Hebrew, Catalan (incomplete) and Polish (incomplete) language files
258
 
259
- = 1.0 =
260
  * Better integration with WP 2.7+ interface
261
  * Added actions for plugins which store post metadata in self-managed tables
262
  * Added French and Spanish language files
263
  * Dropped WP 2.6.5 compatibility
264
 
265
- = 0.6.1 =
266
  * Tested WP 2.9 compatibility
267
 
268
- = 0.6 =
269
  * Fix for WP 2.8.1
270
  * WPMU compatibility
271
  * Internationalization (Italian and Japanese language files shipped)
272
 
273
- = 0.5 =
274
  * Fix for post-meta
275
  * WP2.7 compatibility
276
 
277
- = 0.4 =
278
  * Support for new WP post revision feature
279
 
280
-
281
-
282
- == Template tags ==
283
-
284
- I have added the template tag `duplicate_post_clone_post_link( $link, $before, $after, $id )`, which behaves just like [edit_post_link()](http://codex.wordpress.org/Function_Reference/edit_post_link).
285
- That means that you can put it in your template (e.g., in single.php or page.php) so you can get a "Clone" link when displaying a post or page.
286
-
287
- The parameters are:
288
-
289
- * *link*
290
- (string) (optional) The link text. Default: __('Clone','duplicate-post')
291
-
292
- * *before*
293
- (string) (optional) Text to put before the link text. Default: None
294
-
295
- * *after*
296
- (string) (optional) Text to put after the link text. Default: None
297
-
298
- * *id*
299
- (integer) (optional) Post ID. Default: Current post ID
300
-
301
- Another available template tag is `duplicate_post_get_original($id, $output)` which returns the original post, either as a post object, an associative array or a numeric array (depending on the $output parameter), just as [get_post()](http://codex.wordpress.org/Function_Reference/get_post) does.
302
- `duplicate_post_get_original()` relies on the `_dp_original` custom field.
303
-
304
-
305
- == Action hooks ==
306
-
307
- From version 1.0 onwards, thanks to [Simon Wheatley](http://www.simonwheatley.co.uk/)'s suggestion, Duplicate Post adds two action hooks (*dp_duplicate_post* and *dp_duplicate_page*) which can be used by other developers if their plugins store extra data for posts in non-standard WP tables.
308
- Since Duplicate Post knows only of standard WP tables, it can't copy other data relevant to the post which is being copied if this information is stored elsewhere. So, if you're a plugin developer which acts this way, and you want to ensure compatibility with Duplicate Post, you can hook your functions to those actions to make sure that they will be called when a post (or page) is cloned.
309
-
310
- It's very simple. Just write your function that copies post metadata to a new row of your table:
311
- `function myplugin_copy_post($new_post_id, $old_post_object){
312
- /* your code */
313
- }`
314
-
315
- Then hook the function to the action:
316
- `add_action( "dp_duplicate_post", "myplugin_copy_post", $priority, 2);`
317
-
318
- dp_duplicate_page is used for pages and hierarchical custom post types; for every other type of posts, dp_duplicate_post is used.
319
-
320
- Please refer to the [Plugin API](http://codex.wordpress.org/Plugin_API) for every information about the subject.
321
 
322
  == Contribute ==
323
 
324
  If you find this useful and if you want to contribute, there are three ways:
325
 
326
- 1. You can [write me](https://lopo.it/contatti/) and submit your bug reports, suggestions and requests for features;
327
  2. If you want to translate it to your language (there are just a few lines of text), you can use the [translation project](https://translate.wordpress.org/projects/wp-plugins/duplicate-post);
328
- 3. Using the plugin is free, but if you want you can support my efforts by donating with PayPal [here](https://lopo.it/duplicate-post-plugin/)
329
 
1
  === Duplicate Post ===
2
  Contributors: lopo
3
+ Donate link: https://duplicate-post.lopo.it/
4
  Tags: duplicate post, copy, clone
5
  Requires at least: 3.6
6
+ Tested up to: 4.9
7
+ Stable tag: 3.2
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
11
+ Copy posts of any type with a click!
12
 
13
  == Description ==
14
 
15
+ This plugin allows users to clone posts of any type, or copy them to new drafts for further editing.
16
+ If you find this useful, [**please consider donating**](https://duplicate-post.lopo.it/) whatever sum you choose, **even just 10 cents**. Just a few cents from every user would help me develop the plugin and improve support.
 
17
 
18
  How it works:
19
 
31
 
32
  There is also a **template tag**, so you can put it in your templates and clone your posts/pages from the front-end. Clicking on the link will lead you to the edit page for the new draft, just like the admin bar link.
33
 
34
+ Duplicate Post has many useful settings to customize its behavior and restrict its use to certain roles or post types. Check out the extensive documentation on [the plugin's site](https://duplicate-post.lopo.it).
 
 
 
 
35
 
36
+ **If you're a plugin developer**, I suggest you to read the [Developer's Guide](https://duplicate-post.lopo.it/docs/developers-guide/) to ensure compatibility between your plugin(s) and mine. Feel free to [contact me](https://duplicate-post.lopo.it/contact) so we can keep in touch and collaborate.
37
 
38
  Thanks for all the suggestions, bug reports, translations and donations, they're frankly too many to be listed here!
39
 
52
 
53
  First, check your version of WordPress: the plugin is not supposed to work on old versions anymore. Make sure also to upgrade to the last version of the plugin!
54
 
55
+ Then try to deactivate and re-activate it, some user have reported that this fixes some problems.
56
 
57
+ Pay also attention to the "Permissions" tab in the Settings: make sure the plugin is enabled for the desired roles and post types.
58
 
59
+ If it still doesn't work, maybe there is some kind of conflict with other plugins: feel free [to write in the forum](https://wordpress.org/support/plugin/duplicate-post) and we'll try to discover a solution (it will be *really* helpful if you try to deactivate all your other plugins one by one to see which one conflicts with mine... But do it only if you know what you're doing, I will not be responsible of any problem you may experience).
 
 
60
 
61
  = The plugin is not translated in my language! =
62
 
63
  From version 3.0 the plugin's translations are managed by the WordPress.org platform and the plugin is shipped without language files, so first of all update translations under Dashboard->Updates.
64
 
65
  If Duplicate Post is still in English, or if there are some untraslated strings, you can help traslating to your language [here](https://translate.wordpress.org/projects/wp-plugins/duplicate-post): you only need a WordPress.org account.
66
+ [Contact me](https://duplicate-post.lopo.it/contact) if you wish to become an editor for your language.
67
 
68
  == Screenshots ==
69
 
76
 
77
  == Upgrade Notice ==
78
 
79
+ = 3.2 =
80
+ new website + WPML compatibility + various fixes
81
+
82
  = 3.1.2 =
83
  Fixes the problem with custom fields
84
 
138
 
139
  == Changelog ==
140
 
141
+ = 3.2 (2017-04-04) =
142
+ * new website with extensive documentation
143
+ * WPML compatibility, thanks to WPML team
144
+ * improved Jetpack compatibility (Subscriptions, Markdown)
145
+ * small changes to hooks
146
+ * improved security with nonces
147
+ * various small fixes
148
+
149
+ = 3.1.2 (2016-12-13) =
150
  * Fix for custom fields not copied
151
 
152
+ = 3.1.1 (2016-12-13) =
153
  * Fix for nasty update nag (plus a failsafe checkbox)
154
 
155
+ = 3.1 (2016-12-13) =
156
  * Bulk clone action added (WP 4.7+)
157
  * Wildcards enabled for custom fields to skip
158
  * Options to copy post author, post format (moved from taxonomies), menu order, post template
162
  * Probable fix for repeated clone bug
163
  * Other minor bugs fixed
164
 
165
+ = 3.0.3 (2016-10-29) =
166
  * Notices in admin after copying
167
  * Fixes warning in custom post type archives
168
  * Uses site options for version and notice
169
  * Minor fixes
170
 
171
+ = 3.0.2 (2016-10-18) =
172
  * Can now be enabled for every custom post type with visible UI (not just public ones)
173
  * Admin bar CSS only enqueued when needed
174
  * New "Donate" button
175
  * Fixes for minor bugs and typos
176
 
177
+ = 3.0.1 (2016-10-09) =
178
  * Fixes the issues for people upgrading from an older version
179
 
180
+ = 3.0 (2016-10-09) =
181
  * Settings page redesigned
182
  * More options to enable/disable copy of every part of a post
183
  * Enable/disable cloning for every custom post type
187
  * Translations removed to use WP.org's official translation project
188
  * Checked PHP 7 compatibility
189
 
190
+ = 2.6 (2014-04-27) =
191
  * PHP 5.4 (Strict Standards) compatible
192
  * Fixed possible XSS and SQL injections
193
  * other bugs
194
  * Updated and added translations
195
  * Tested up to WP 3.8.1
196
 
197
+ = 2.4.1 (2014-02-22) =
198
  * Fixed regression about draft permalinks
199
  * Fixed bug with guid
200
  * Don't clone to_ping and pinged (maybe there will be an option about those later)
201
 
202
+ = 2.4 (2012-04-29) =
203
  * New option to clone the children of the original page
204
  * Licence changed to GPLv2 or later
205
  * Fixed publishing dates for drafts
206
  * Fixed bug with prefix/suffix
207
  * Translation project moved to GlotPress
208
 
209
+ = 2.3 (2012-04-06) =
210
  * Added options to choose where to show the "Clone" links
211
  * Clone attachments (i.e. references in the DB, not physical files)
212
  * Fix for untranslated user roles
213
  * Some other fixes (missing checks, PHP warnings and errors, etc.)
214
 
215
+ = 2.2 (2012-02-01) =
216
  * Fix for problems when copying serialized meta fields
217
  * Fix for multiple _dp_original field
218
  * Removed deprecated parameter when adding options
219
 
220
+ = 2.1.1 (2012-01-04) =
221
  * Can't rely on activation hook for upgrade, this caused problems with new options
222
 
223
+ = 2.1 (2012-01-03) =
224
  * Even more code cleaning (no more custom queries, using WP API)
225
  * Term order preserved when copying
226
  * Stopped using deprecated User levels, now it uses Roles and Capabilities
228
  * duplicate_post_get_original template tag
229
  * Settings link in plugin list, 'Donate' and 'Translate' link in option page
230
 
231
+ = 2.0.2 (2011-12-12) =
232
  * Fixed bug for permalinks
233
  * Two links on posts list: clone immediately or copy to a new draft to edit.
234
  * Tested on multisite mode.
235
 
236
+ = 2.0.1 (2011-12-08) =
237
  * Fixed bug for action filters
238
  * New option so you can choose if cloning from the posts list must copy the post status (draft, published, pending) too.
239
 
240
+ = 2.0 (2011-12-08) =
241
  * WP 3.3 compatibility (still not tested against multiblog feature, so beware)
242
  * Minimum WP version: 3.0
243
  * Code cleanup
246
  * Added suffix option
247
  * Added template tag
248
 
249
+ = 1.1.2 (2011-04-08) =
250
  * WP 3.1.1 compatibility (still not tested against multiblog feature, so beware)
251
  * Added complete Polish language files
252
 
253
+ = 1.1.1 (2010-06-30) =
254
  * Plugin split in two files for faster opening in Plugins list page
255
  * fix conflicts with a few other plugins
256
  * Added Dutch language files
257
 
258
+ = 1.1 (2010-06-24) =
259
  * WP 3.0 compatibility (not tested against multiblog feature, so beware)
260
  * Option page: minimum user level, title prefix, fields not to be copied, copy post/page date also
261
  * Added German, Swedish, Romanian, Hebrew, Catalan (incomplete) and Polish (incomplete) language files
262
 
263
+ = 1.0 (2010-06-15) =
264
  * Better integration with WP 2.7+ interface
265
  * Added actions for plugins which store post metadata in self-managed tables
266
  * Added French and Spanish language files
267
  * Dropped WP 2.6.5 compatibility
268
 
269
+ = 0.6.1 (2009-12-03) =
270
  * Tested WP 2.9 compatibility
271
 
272
+ = 0.6 (2007-07-21) =
273
  * Fix for WP 2.8.1
274
  * WPMU compatibility
275
  * Internationalization (Italian and Japanese language files shipped)
276
 
277
+ = 0.5 (2009-01-09) =
278
  * Fix for post-meta
279
  * WP2.7 compatibility
280
 
281
+ = 0.4 (2008-11-23) =
282
  * Support for new WP post revision feature
283
 
284
+ = 0.3 (2008-03-01) =
285
+ * Initial version on WP repository
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
286
 
287
  == Contribute ==
288
 
289
  If you find this useful and if you want to contribute, there are three ways:
290
 
291
+ 1. You can [write me](https://duplicate-post.lopo.it/contact) and submit your bug reports, suggestions and requests for features;
292
  2. If you want to translate it to your language (there are just a few lines of text), you can use the [translation project](https://translate.wordpress.org/projects/wp-plugins/duplicate-post);
293
+ 3. Using the plugin is free, but if you want you can support my efforts by donating with PayPal [here](https://duplicate-post.lopo.it/donate)
294