From 1991552d4b5cd325293906b618d5a05584ea273b Mon Sep 17 00:00:00 2001 From: aurovrata Date: Sun, 15 May 2022 22:04:57 +0530 Subject: [PATCH] v2.5rc1 --- README.txt | 7 +++++-- admin/class-cf7-polylang-admin.php | 14 +++++++++++--- cf7-polylang.php | 4 ++-- 3 files changed, 18 insertions(+), 7 deletions(-) diff --git a/README.txt b/README.txt index b804a3d..9a604ac 100755 --- a/README.txt +++ b/README.txt @@ -4,7 +4,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_i Tags: polylang, contact form 7, multisite, contact form 7 extension, contact form 7 module, multilingual contact form 7, multilingual form, cf7 smart grid extension Requires at least: 4.7 Requires PHP: 5.6 -Tested up to: 5.9.2 +Tested up to: 6.0 Stable tag: trunk License: GPLv2 or later License URI: http://www.gnu.org/licenses/gpl-2.0.html @@ -145,9 +145,12 @@ this filter should be used by plugin developers to ensure their plugin translati 4. Ensure you enable translations for Contact Forms in your Polyland settings. == Changelog == +== 2.5.0 == +* introduce 'cf7pll_sync_form_metakeys' to filter the synchronised form metakeys between translations. +* improve translation sync from original post. = 2.4.1 = * fix language update. -* add notice to post-new pages. +* add notice to post-new pages. = 2.4.0 = * enable other plugins to add their translation files. * added 'cf7pll_load_plugin_translation_resource' filter. diff --git a/admin/class-cf7-polylang-admin.php b/admin/class-cf7-polylang-admin.php index ba786f1..8544ff2 100755 --- a/admin/class-cf7-polylang-admin.php +++ b/admin/class-cf7-polylang-admin.php @@ -421,7 +421,7 @@ public function new_polylang_locale_added( $term_id, $tt_id, $taxonomy ){ } /** * Stop polylang synchronising form meta fields. - * + * hooked to 'pll_copy_post_metas' * @since 1.4.3 * @param array $keys meta fields to be synched . * @param boolean $sync if synchorinsation is enabled . @@ -429,9 +429,17 @@ public function new_polylang_locale_added( $term_id, $tt_id, $taxonomy ){ * @return array filtered meta fields to be synched. **/ public function polylang_meta_fields_sync($keys, $sync, $post_id){ - if(!$sync) return $keys; + debug_msg("duplicating...$post_id/$sync"); if('wpcf7_contact_form' != get_post_type($post_id)) return $keys; - else return array(); //don't sync any cf7 meta fields + else { /** @since 2.5.0 let's sync settings, form, and other props from cf7sg */ + $form = wpcf7_contact_form($post_id); + $props = array(); + foreach($form->get_properties() as $prop){ + array_push($props, "_{$prop}"); + } + $keys = array_merge($keys, Cf7_Grid_Layout_Admin::METAKEYS, $props); + return apply_filters('cf7pll_sync_form_metakeys',$keys, get_cf7form_key($post_id), $post_id); + } } /** * Fix for special email tag [_site_url]. diff --git a/cf7-polylang.php b/cf7-polylang.php index e4fe512..0cd42ee 100755 --- a/cf7-polylang.php +++ b/cf7-polylang.php @@ -16,7 +16,7 @@ * Plugin Name: Contact Form 7 Polylang extension * Plugin URI: http://wordpress.syllogic.in * Description: This plugin extends Contact Form 7 plugin to manage multiple language forms using the PolyLang plugin. It Requires both plugins to be active first. - * Version: 2.4.1 + * Version: 2.5.0rc1 * Author: Aurovrata V. * Author URI: http://syllogic.in * License: GPL-2.0+ @@ -30,7 +30,7 @@ die; } define( 'CF7_POLYLANG_PATH', plugin_dir_path( __FILE__ ) ); -define( 'CF7_POLYLANG_VERSION', '2.4.1' ); +define( 'CF7_POLYLANG_VERSION', '2.5.0rc1' ); /** * The code that runs during plugin activation. * This action is documented in includes/class-cf7-polylang-activator.php