Duplicate Post - Version 3.2.6

Version Description

Compatibility with WP 5.5 + various fixes

Download this release

Release Info

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

Code changes from version 3.2.5 to 3.2.6

duplicate-post-admin.php CHANGED
@@ -193,12 +193,13 @@ function duplicate_post_plugin_upgrade() {
193
  delete_option('duplicate_post_view_user_level');
194
  delete_option('dp_notice');
195
 
 
 
 
 
 
196
  delete_site_option('duplicate_post_version');
197
  update_option( 'duplicate_post_version', duplicate_post_get_current_version() );
198
-
199
- delete_option('duplicate_post_show_notice', 0);
200
- update_site_option('duplicate_post_show_notice', 1);
201
-
202
  }
203
 
204
  /**
@@ -206,11 +207,19 @@ function duplicate_post_plugin_upgrade() {
206
  */
207
  function duplicate_post_show_update_notice() {
208
  if(!current_user_can( 'manage_options')) return;
 
 
 
 
 
 
 
 
 
209
  $class = 'notice is-dismissible';
210
  /* translators: %1$s: Yoast, %2$s: version number */
211
  $message = '<p style="margin: 0;"><strong>' . sprintf( __( 'What\'s new in %1$s Duplicate Post version %2$s:', 'duplicate-post' ), 'Yoast', DUPLICATE_POST_CURRENT_VERSION ) . '</strong> ';
212
- /* translators: %s: Yoast */
213
- $message .= sprintf( __( 'First release from %s + accessibility improvements + deprecated filter', 'duplicate-post' ), 'Yoast' ) . '</p>';
214
  $message .= '<p>%%SIGNUP_FORM%%</p>';
215
  $message .= esc_html__('Serving the WordPress community since November 2007.', 'duplicate-post');
216
  global $wp_version;
@@ -277,7 +286,7 @@ function duplicate_post_newsletter_signup_form() {
277
  <div class="mc-field-group" style="margin-top: 8px;">
278
  <label for="mce-EMAIL">' . $email_label . '</label>
279
  <input type="email" value="" name="EMAIL" class="required email" id="mce-EMAIL">
280
- <input type="submit" value="Subscribe" name="subscribe" id="mc-embedded-subscribe" class="button">
281
  </div>
282
  <div id="mce-responses" class="clear">
283
  <div class="response" id="mce-error-response" style="display:none"></div>
@@ -739,7 +748,7 @@ function duplicate_post_copy_comments($new_id, $post){
739
  $old_id_to_new = array();
740
  foreach ($comments as $comment){
741
  //do not copy pingbacks or trackbacks
742
- if(!empty($comment->comment_type)) continue;
743
  $parent = ($comment->comment_parent && $old_id_to_new[$comment->comment_parent])?$old_id_to_new[$comment->comment_parent]:0;
744
  $commentdata = array(
745
  'comment_post_ID' => $new_id,
@@ -747,7 +756,7 @@ function duplicate_post_copy_comments($new_id, $post){
747
  'comment_author_email' => $comment->comment_author_email,
748
  'comment_author_url' => $comment->comment_author_url,
749
  'comment_content' => $comment->comment_content,
750
- 'comment_type' => '',
751
  'comment_parent' => $parent,
752
  'user_id' => $comment->user_id,
753
  'comment_author_IP' => $comment->comment_author_IP,
@@ -909,10 +918,15 @@ function duplicate_post_action_admin_notice() {
909
 
910
 
911
  /*** BULK ACTIONS ***/
912
- add_action('admin_init', 'duplicate_post_add_bulk_filters_for_enabled_post_types');
913
 
914
- function duplicate_post_add_bulk_filters_for_enabled_post_types(){
915
  if(get_option('duplicate_post_show_bulkactions') != 1) return;
 
 
 
 
 
916
  $duplicate_post_types_enabled = get_option('duplicate_post_types_enabled', array ('post', 'page'));
917
  if(!is_array($duplicate_post_types_enabled)) $duplicate_post_types_enabled = array($duplicate_post_types_enabled);
918
  foreach($duplicate_post_types_enabled as $duplicate_post_type_enabled){
193
  delete_option('duplicate_post_view_user_level');
194
  delete_option('dp_notice');
195
 
196
+ delete_option('duplicate_post_show_notice' );
197
+ if ( version_compare( $installed_version, '3.2.5' ) < 0) {
198
+ update_site_option( 'duplicate_post_show_notice', 1 );
199
+ }
200
+
201
  delete_site_option('duplicate_post_version');
202
  update_option( 'duplicate_post_version', duplicate_post_get_current_version() );
 
 
 
 
203
  }
204
 
205
  /**
207
  */
208
  function duplicate_post_show_update_notice() {
209
  if(!current_user_can( 'manage_options')) return;
210
+
211
+ $current_screen = get_current_screen();
212
+ if ( empty( $current_screen ) ||
213
+ empty( $current_screen->base ) ||
214
+ ( $current_screen->base !== "dashboard" && $current_screen->base !== "plugins" )
215
+ ) {
216
+ return;
217
+ }
218
+
219
  $class = 'notice is-dismissible';
220
  /* translators: %1$s: Yoast, %2$s: version number */
221
  $message = '<p style="margin: 0;"><strong>' . sprintf( __( 'What\'s new in %1$s Duplicate Post version %2$s:', 'duplicate-post' ), 'Yoast', DUPLICATE_POST_CURRENT_VERSION ) . '</strong> ';
222
+ $message .= sprintf( __( 'Compatibility with WP 5.5 + various fixes', 'duplicate-post' ), 'Yoast' ) . '</p>';
 
223
  $message .= '<p>%%SIGNUP_FORM%%</p>';
224
  $message .= esc_html__('Serving the WordPress community since November 2007.', 'duplicate-post');
225
  global $wp_version;
286
  <div class="mc-field-group" style="margin-top: 8px;">
287
  <label for="mce-EMAIL">' . $email_label . '</label>
288
  <input type="email" value="" name="EMAIL" class="required email" id="mce-EMAIL">
289
+ <input type="submit" value="' . esc_attr__( 'Subscribe', 'duplicate-post' ) . '" name="subscribe" id="mc-embedded-subscribe" class="button">
290
  </div>
291
  <div id="mce-responses" class="clear">
292
  <div class="response" id="mce-error-response" style="display:none"></div>
748
  $old_id_to_new = array();
749
  foreach ($comments as $comment){
750
  //do not copy pingbacks or trackbacks
751
+ if( $comment->comment_type === "pingback" || $comment->comment_type === "trackback" ) continue;
752
  $parent = ($comment->comment_parent && $old_id_to_new[$comment->comment_parent])?$old_id_to_new[$comment->comment_parent]:0;
753
  $commentdata = array(
754
  'comment_post_ID' => $new_id,
756
  'comment_author_email' => $comment->comment_author_email,
757
  'comment_author_url' => $comment->comment_author_url,
758
  'comment_content' => $comment->comment_content,
759
+ 'comment_type' => $comment->comment_type,
760
  'comment_parent' => $parent,
761
  'user_id' => $comment->user_id,
762
  'comment_author_IP' => $comment->comment_author_IP,
918
 
919
 
920
  /*** BULK ACTIONS ***/
921
+ add_action('admin_init', 'duplicate_post_add_bulk_filters');
922
 
923
+ function duplicate_post_add_bulk_filters(){
924
  if(get_option('duplicate_post_show_bulkactions') != 1) return;
925
+
926
+ if ( ! duplicate_post_is_current_user_allowed_to_copy() ) {
927
+ return;
928
+ }
929
+
930
  $duplicate_post_types_enabled = get_option('duplicate_post_types_enabled', array ('post', 'page'));
931
  if(!is_array($duplicate_post_types_enabled)) $duplicate_post_types_enabled = array($duplicate_post_types_enabled);
932
  foreach($duplicate_post_types_enabled as $duplicate_post_type_enabled){
duplicate-post-options.php CHANGED
@@ -540,7 +540,7 @@ function duplicate_post_options() {
540
  $taxonomies = get_taxonomies( array(), 'objects' );
541
  usort( $taxonomies, 'duplicate_post_tax_obj_cmp' );
542
  $taxonomies_blacklist = get_option( 'duplicate_post_taxonomies_blacklist' );
543
- if ( '' === $taxonomies_blacklist ) {
544
  $taxonomies_blacklist = array();
545
  }
546
  foreach ( $taxonomies as $taxonomy ) :
@@ -725,7 +725,7 @@ function duplicate_post_options() {
725
  esc_html__( 'You can also use the template tag %1$sduplicate_post_clone_post_link( $link, $before, $after, $id )%2$s. %3$sMore info on the template tag%4$s.', 'duplicate-post' ),
726
  '<code>',
727
  '</code>',
728
- '<a href="' . esc_url( 'https://duplicate-post.lopo.it/docs/developers-guide/functions-template-tags/duplicate_post_clone_post_link/' ) . '">',
729
  '</a>'
730
  );
731
  ?>
540
  $taxonomies = get_taxonomies( array(), 'objects' );
541
  usort( $taxonomies, 'duplicate_post_tax_obj_cmp' );
542
  $taxonomies_blacklist = get_option( 'duplicate_post_taxonomies_blacklist' );
543
+ if ( ! is_array( $taxonomies_blacklist ) ) {
544
  $taxonomies_blacklist = array();
545
  }
546
  foreach ( $taxonomies as $taxonomy ) :
725
  esc_html__( 'You can also use the template tag %1$sduplicate_post_clone_post_link( $link, $before, $after, $id )%2$s. %3$sMore info on the template tag%4$s.', 'duplicate-post' ),
726
  '<code>',
727
  '</code>',
728
+ '<a href="' . esc_url( 'https://developer.yoast.com/duplicate-post/functions-template-tags#duplicate_post_clone_post_link' ) . '">',
729
  '</a>'
730
  );
731
  ?>
duplicate-post.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: Yoast Duplicate Post
4
  * Plugin URI: https://yoast.com/wordpress/plugins/duplicate-post/
5
  * Description: Clone posts and pages.
6
- * Version: 3.2.5
7
  * Author: Enrico Battocchi & Team Yoast
8
  * Author URI: https://yoast.com
9
  * Text Domain: duplicate-post
@@ -31,7 +31,7 @@ if ( ! defined( 'ABSPATH' ) ) {
31
  }
32
 
33
  // Version of the plugin
34
- define('DUPLICATE_POST_CURRENT_VERSION', '3.2.5' );
35
 
36
  /**
37
  * Initialise the internationalisation domain
3
  * Plugin Name: Yoast Duplicate Post
4
  * Plugin URI: https://yoast.com/wordpress/plugins/duplicate-post/
5
  * Description: Clone posts and pages.
6
+ * Version: 3.2.6
7
  * Author: Enrico Battocchi & Team Yoast
8
  * Author URI: https://yoast.com
9
  * Text Domain: duplicate-post
31
  }
32
 
33
  // Version of the plugin
34
+ define('DUPLICATE_POST_CURRENT_VERSION', '3.2.6' );
35
 
36
  /**
37
  * Initialise the internationalisation domain
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: yoast, lopo
3
  Donate link: https://yoast.com/wordpress/plugins/duplicate-post/
4
  Tags: duplicate post, copy, clone
5
  Requires at least: 3.6
6
- Tested up to: 5.4
7
- Stable tag: 3.2.4
8
  Requires PHP: 5.2.4
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
@@ -71,6 +71,9 @@ If Duplicate Post is still in English, or if there are some untraslated strings,
71
 
72
  == Upgrade Notice ==
73
 
 
 
 
74
  = 3.2.5 =
75
  First release from Yoast + accessibility improvements + filter deprecated
76
 
@@ -148,6 +151,14 @@ New features and customization, WP 3.0 compatibility: you should upgrade if you
148
 
149
  == Changelog ==
150
 
 
 
 
 
 
 
 
 
151
  = 3.2.5 (2020-07-07) =
152
  * First release from Yoast
153
  * Accessibility improvements to the settings page
3
  Donate link: https://yoast.com/wordpress/plugins/duplicate-post/
4
  Tags: duplicate post, copy, clone
5
  Requires at least: 3.6
6
+ Tested up to: 5.5
7
+ Stable tag: 3.2.6
8
  Requires PHP: 5.2.4
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
71
 
72
  == Upgrade Notice ==
73
 
74
+ = 3.2.6 =
75
+ Compatibility with WP 5.5 + various fixes
76
+
77
  = 3.2.5 =
78
  First release from Yoast + accessibility improvements + filter deprecated
79
 
151
 
152
  == Changelog ==
153
 
154
+ = 3.2.6 (2020-09-17) =
155
+ * Compatibility with WordPress 5.5
156
+ * Fixed bug about copying comments in WordPress 5.5
157
+ * Check user permission when adding option to the bulk actions dropdown list
158
+ * Improved update notice to be displayed only on selected screens when updating from < 3.2.5
159
+ * Updated template tag documentation link
160
+ * Added missing gettext to "Subscribe" button
161
+
162
  = 3.2.5 (2020-07-07) =
163
  * First release from Yoast
164
  * Accessibility improvements to the settings page