Changeset 2885100
- Timestamp:
- 03/22/2023 04:37:23 PM (3 years ago)
- Location:
- page-parts/trunk
- Files:
-
- 4 edited
-
CHANGELOG.md (modified) (2 diffs)
-
admin/admin.php (modified) (2 diffs)
-
page-parts.php (modified) (2 diffs)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
page-parts/trunk/CHANGELOG.md
r2650675 r2885100 4 4 5 5 ## [Unreleased] 6 7 ## [1.4.2] - 2023-03-22 8 9 ### Fixed 10 - Fix compatibility with WPML plugin where page part translations are duplicated. 6 11 7 12 ## [1.4.1] - 2021-12-29 … … 135 140 - First public release. 136 141 137 [Unreleased]: https://github.com/benhuson/page-parts/compare/1.4.1...HEAD 142 [Unreleased]: https://github.com/benhuson/page-parts/compare/1.4.2...HEAD 143 [1.4.2]: https://github.com/benhuson/page-parts/compare/1.4.1...1.4.2 138 144 [1.4.1]: https://github.com/benhuson/page-parts/compare/1.4...1.4.1 139 145 [1.4]: https://github.com/benhuson/page-parts/compare/1.3.1...1.4 -
page-parts/trunk/admin/admin.php
r2650675 r2885100 745 745 if ( isset( $_POST['parent_id'] ) && current_user_can( 'edit_page', $post_id ) ) { 746 746 747 $parent_id = absint( $_POST['parent_id'] ); 748 $post_type_object = get_post_type_object( get_post_type( $parent_id ) ); 749 750 if ( 0 == $parent_id || ( $post_type_object && current_user_can( $post_type_object->cap->edit_post, $post_id ) ) ) { 751 $wpdb->update( $wpdb->posts, array( 'post_parent' => $parent_id ), array( 'ID' => $post_id ) ); 747 // For WPML compatibility, check this is not a duplicate translation 748 if ( ! $this->is_post_a_wpml_duplicate( $post_id ) ) { 749 750 $parent_id = absint( $_POST['parent_id'] ); 751 $post_type_object = get_post_type_object( get_post_type( $parent_id ) ); 752 753 if ( 0 == $parent_id || ( $post_type_object && current_user_can( $post_type_object->cap->edit_post, $post_id ) ) ) { 754 $wpdb->update( $wpdb->posts, array( 'post_parent' => $parent_id ), array( 'ID' => $post_id ) ); 755 } 756 752 757 } 753 758 … … 841 846 842 847 <?php 848 } 849 850 /** 851 * Check if post is a WPML duplicate. 852 * Used to prevent overriding post parent for duplicate translations. 853 * 854 * Note: 855 * WPML_ELEMENT_IS_NOT_TRANSLATED = 0 856 * WPML_ELEMENT_IS_TRANSLATED = 1 857 * WPML_ELEMENT_IS_DUPLICATED = 2 858 * WPML_ELEMENT_IS_A_DUPLICATE = 3 859 * 860 * @param integer $post_id 861 * @return boolean 862 */ 863 protected function is_post_a_wpml_duplicate( $post_id ) { 864 865 $translation_type = apply_filters( 'wpml_element_translation_type', NULL, $post_id, get_post_type( $post_id ) ); 866 867 return 3 === $translation_type; 868 843 869 } 844 870 -
page-parts/trunk/page-parts.php
r2650675 r2885100 5 5 Plugin URI: https://github.com/benhuson/page-parts 6 6 Description: Manage subsections of a page. 7 Version: 1.4. 17 Version: 1.4.2 8 8 Author: Ben Huson 9 9 Author URI: https://github.com/benhuson … … 11 11 */ 12 12 13 define( 'PAGE_PARTS_VERSION', '1.4. 1' );13 define( 'PAGE_PARTS_VERSION', '1.4.2' ); 14 14 define( 'PAGE_PARTS_FILE', __FILE__ ); 15 15 -
page-parts/trunk/readme.txt
r2650675 r2885100 3 3 Tags: pages, cms 4 4 Requires at least: 3.9 5 Tested up to: 5.8.26 Stable tag: 1.4. 15 Tested up to: 6.1.1 6 Stable tag: 1.4.2 7 7 License: GPL2 or later 8 8 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 38 38 39 39 = Unreleased = 40 41 = 1.4.2 = 42 43 __Fixed__ 44 - Fix compatibility with WPML plugin where page part translations are duplicated. 40 45 41 46 = 1.4.1 =
Note: See TracChangeset
for help on using the changeset viewer.