Resolved
Reported for: Contact Form 7 Multilingual 1.2.1
Resolved in: Contact Form 7 Multilingual 1.2.2
Overview of the issue
When adding forms using Contact Form 7 plugin and the do_shortcode() PHP method, the forms do not appear translated as expected.
Workaround
Please, make sure of having a full backup of your site before proceeding.
- Open …/wp-content/plugins/contact-form-7-multilingual/classes/shortcodes.php file.
- Look for line 21.
- Replace:
public function translate_shortcode_form_id( $atts ) { $form = null; if ( ! empty( $atts['id'] ) ) { $form = wpcf7_contact_form( (int) $atts['id'] ); } if ( ! $form && ! empty( $atts['title'] ) ) { $form = wpcf7_get_contact_form_by_title( trim( $atts['title'] ) ); unset( $atts['title'] ); } if ( $form ) { $atts['id'] = apply_filters( 'wpml_object_id', $form->id(), Constants::POST_TYPE, true ); } return $atts; }
- For:
public function translate_shortcode_form_id( $atts ) { $form = null; if ( ! empty( $atts['id'] ) && is_numeric($atts['id']) ) { $form = wpcf7_contact_form( (int) $atts['id'] ); } if ( ! $form && ! empty( $atts['title'] ) ) { $form = wpcf7_get_contact_form_by_title( trim( $atts['title'] ) ); unset( $atts['title'] ); } if ($form == null){ $form = wpcf7_get_contact_form_by_hash( $atts['id']); } if ( $form ) { $atts['id'] = apply_filters( 'wpml_object_id', $form->id(), Constants::POST_TYPE, true ); } return $atts; }
Hi,
I’m glad I found a fix for that problem here but I wonder why you don’t update the Contact Form 7 Multilingual Plugin? Version 1.2.1 was released 8 month ago and the bug is quite serious if you ask me.
Don’t get me wrong – you are doing a great job otherwise!!
Best regards and have a good time
Karsten
Hello Karsten,
We are glad this erratum was helpful. Our devs roadmap has been busy with other WPML releases and new add-ons, however this is totally in our radar and we will be publishing a new version soon.
We will keep this page updated once it is release.
Thank you for your understanding.
Andrés