Support » Plugin: Contact Form 7 Polylang Module » Each form override his translation when saving

  • Resolved Colir

    (@colir)


    Hi.
    I’m using all the lastest version of WP, CF7, Polylang and CF7 Polylang.
    Since an update (i’didn’t know wich one), when i’m saving a form which is translated, it override his translation, so i can’t get translated form anymore…

    no js error in console…

    Do you have any idea ?

    thank you

Viewing 15 replies - 1 through 15 (of 23 total)
  • Plugin Author Aurovrata Venet

    (@aurovrata)

    CF7 4.8 is breaking many plugins (here and here too), it is advised not to upgrade until the issues are fixed. I have not tried the plugin with 4.8 as yet due to these ongoing issues.

    Currently I am too busy to dive into the Cf7 4.8 code to understand what has changed. Some of the plugins I maintain also have issues with cf7 4.8. So until I roll out a fix, I recommend you stick to cf7 4.7.

    Thread Starter Colir

    (@colir)

    Hi.
    Thanks for your answer.

    I’ve digged the problem, and found the solution.

    This arrive when we ask to Polylang to synchronize the custom_meta (post_meta).

    As Contact form 7 use the post_meta “_form” to register / display the form content, when polylang synchronize the post meta, this override the translation.

    So we can easly turn off the post_meta synchronisation in the Polylang setting, but in some case, this can be useful.

    Do you have any suggestion to remove the post_meta synchronization only for CF7 post type ?

    thank you.

    Plugin Author Aurovrata Venet

    (@aurovrata)

    Makes sense.

    As Contact form 7 use the post_meta β€œ_form” to register / display the form content, when polylang synchronize the post meta, this override the translation.

    ‘_'<meta name> is a format that is used by many plugins to name meta_fields that are internal to the plugin and therefore it ought to be considered a bug in Polylang if it synchronises these.

    Do you have any suggestion to remove the post_meta synchronization only for CF7 post type ?

    I found this filter in the polylang

    
    /**
     * Filter the custom fields to copy or synchronize
     *
     * @since 0.6
     * @since 1.9.2 The <code>$from</code>, <code>$to</code>, <code>$lang</code> parameters were added.
     *
     * @param array  $keys list of custom fields names
     * @param bool   $sync true if it is synchronization, false if it is a copy
     * @param int    $from id of the post from which we copy informations
     * @param int    $to   id of the post to which we paste informations
     * @param string $lang language slug
     */
    $keys = array_unique( apply_filters( 'pll_copy_post_metas', $keys, $sync, $from, $to, $lang ) );

    Check if the post_type of the $from parameter and simply return an empty array if it is a cf7 post

    Hi,

    since I’m really bad in programming, I hope there is very soon a solution to this.

    Thanks already to whom who helps.

    Albert

    Plugin Author Aurovrata Venet

    (@aurovrata)

    @colir did you manage to fix your issue?

    @albert0346 you should be able to fix this with the following code in your themes functions.php file,

    add_filter('pll_copy_post_metas', 'polylang_filter_cf7_meta_fields', 10,3);
    function polylang_filter_cf7_meta_fields($keys, $sync, $post_id){
      if(!$sync) return $keys;
      if('wpcf7_contact_form' != get_post_type($post_id)) return $keys;
      else return array(); //don't sync any cf7 meta fields 
    }
    Plugin Author Aurovrata Venet

    (@aurovrata)

    I just released v1.4.3 with this filter now enabled by default in the plugin.

    I tried 1.4.3. When I hit now the +-sign for the other language I get the message if I want to leave the page, even when I previously saved it. Then on the other language page there are no language changing possibilities on the right side. After entering and saving the text the other language text is overwritten with the newly entered text, as in the previous version.

    Albert

    Thread Starter Colir

    (@colir)

    @aurovrata thank you for the correction, i will look at your update.

    Plugin Author Aurovrata Venet

    (@aurovrata)

    Hello Albert

    When I hit now the +-sign for the other language I get the message if I want to leave the page, even when I previously saved it.

    please read the installation instructions note at the bottom of the list.
    Wrt to the overwriting, it seems to be working fine for me. I am unable to reproduce the error on my testing server. Can you please tell me which version of,

    • WordPress
    • PolyLang
    • Contact Form 7

    your working with?

    Sorry Aurovrata not reading the whole installation instruction πŸ™

    WordPress: 4.8
    Polylang: 2.1.5
    Contact Form 7: 4.8

    I use also Polylang Theme Strings 3.4

    Albert

    Plugin Author Aurovrata Venet

    (@aurovrata)

    Unfortunately Contact Form 7 4.8 is breaking many plugin extensions and there are a number of ongoing discussion on this topic. I have just started testing with cf7 4.8 and this may be the cause of the problem.

    Would you mind reverting your cf7 plugin to 4.7 and see if you can get it to work?

    Sorry, I have the same problem with cf7 4.7.

    Albert

    Plugin Author Aurovrata Venet

    (@aurovrata)

    Can you please deactivate all your plugins except for

    cf7
    polylang
    this plugin

    and see if you can translate your forms

    Sorry! I deactivated 14 plugins leaving only those you mentioned – the same result.

    Albert

    Plugin Author Aurovrata Venet

    (@aurovrata)

    bummer! πŸ™

    So at least that narrows down to the plugin for sure.

    Can you please tell me which synchronising settings you have enabled in your Language->Settings section of your dashboard

Viewing 15 replies - 1 through 15 (of 23 total)
  • The topic ‘Each form override his translation when saving’ is closed to new replies.