Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #1290052

    Hallo,
    in my current project I am developing with enfold and polylang.
    Is it possible to use a second “text” in another language in the build-in enfold DSGVO-form function (generating the checkbox)?

    Thank you in advance,
    Marc

    #1291655

    Hey phil-0071,

    Thank you for the inquiry.

    You should be able to add something like this in the functions.php file to change the text of the checkbox for another language.

    add_action('after_setup_theme', function() {
    	remove_filter( 'avf_sc_contact_form_elements', array( 'av_privacy_class', 'av_privacy_contactform_checkbox'), 10, 2  );
    	add_filter( 'avf_sc_contact_form_elements', 'av_privacy_contactform_checkbox_mod', 10, 2  );
    }, 10);
    
    function av_privacy_contactform_checkbox_mod($fields, $atts) {
    	$content = avia_get_option('privacy_message_contact');
    
    	if(pll_current_language("locale") == "en_GB") {
    		$content = "CUSTOM TEXT FOR ANOTHER LANGUAGE en_GB";
    	}
    
    	if( empty( $content ) )
    	{
    		$content = av_privacy_class::get_default_privacy_message();
    	}
    
    	$fields['av_privacy_agreement'] = array(
    		'label' 	=> $content,
    		'type' 		=> 'checkbox',
    		'options' 	=> '',
    		'check' 	=> 'is_empty',
    		'width' 	=> '',
    		'av_uid' 	=> '',
    		'class'		=> 'av_form_privacy_check av_contact_privacy_check',
    	);
    
    	return $fields ;
    }
    

    This line of code adjusts the content when the active or current language has the locale en_GB.

    if(pll_current_language("locale") == "en_GB") {
    		$content = "CUSTOM TEXT FOR ANOTHER LANGUAGE";
    	}
    

    Adjust it as necessary.

    Best regards,
    Ismael

    #1291915

    Hey Ismael,
    first at all thank you very very much for your deep wp-work!
    I tried the snippet and got the problem that there are no input fields, also there seems to be no different checkbox text, its still the german version.
    Also both languages (de_DE, en_GB) seem to be identical.
    Maybe you could be so kind and take another look?
    I copied you the part of the source which contained the form part, the output for both languages is the same.

    Easter regards,
    Phil

    <form action=”http://conwol.mto2.de/en/contact/&#8221; method=”post” class=”avia_ajax_form av-form-labels-visible avia-builder-el-11 el_after_av_hr el_before_av_hr av-custom-form-color av-dark-form ” data-avia-form-id=”1″ data-avia-redirect=” ><fieldset><p class=’av_form_privacy_check av_contact_privacy_check first_form form_element form_fullwidth’ id=’element_avia_1_1′> <input name=”avia_1_1″ class=”input_checkbox is_empty” type=”checkbox” id=”avia_1_1″ value=”true”/><label class=”input_checkbox_label” for=”avia_1_1″>Die Checkbox für die Zustimmung zur Speicherung ist nach DSGVO zwingend. Dieses Formular speichert Ihren Namen, Ihre E-Mail-Adresse sowie den Nachrichtentext, damit wir Ihre Nachricht auswerten können. Weitere Informationen finden Sie auf unserer Seite der Datenschutzbestimmungen. <abbr class=”required” title=”required”>*</abbr></label></p><p class=”form_element “><input type=”hidden” value=”1″ name=”avia_generated_form1″ /><input type=”submit” value=”Send” class=”button” data-sending-label=”Sending”/></p></fieldset></form><div id=”ajaxresponse_1″ class=”ajaxresponse ajaxresponse_1 hidden”></div>
    <div style=’height:20px’ class=’hr hr-invisible avia-builder-el-12 el_after_av_contact el_before_av_textblock ‘><span class=’hr-inner ‘ ><span class=’hr-inner-style’></span></span></div>

    #1292446

    Hi,

    Sorry for the delay. I forgot to include the $fields and $atts parameters in the new function. Please try the updated code above.

    If it does not work, please post the FTP and WP details in the private field so that we could test the modification.

    Best regards,
    Ismael1

    #1292721
    This reply has been marked as private.
    #1293170

    Hi,

    Thank you for the info.

    The FTP above is working, but we cannot access the site or the WP dasbboard to test the changes because it is asking for another authentication. Did you enable the htpassword or something similar?

    Best regards,
    Ismael

    #1293248
    This reply has been marked as private.
    #1293827

    Hi,

    No worries. The changes seems to be showing properly on our end, as shown in the screenshot below.

    // https://imgur.com/9ERTOCH

    Please make sure to purge the cache or do a hard refresh of the browser before checking the page.

    Thank you for your patience.

    Best regards,
    Ismael

    #1293868

    Hi Ismael,
    thank you very very much, you made my day :-)
    Very professional work and mega-best theme support!

    Have a nice week, best regards from Berlin,
    Phil

    #1294191

    Hi,

    Glad Ismael could help! :)

    For your information, you can take a look at Enfold documentation here – https://kriesi.at/documentation/enfold/

    If you have any other questions or issues, feel free to start a new thread under Enfold sub forum and we will gladly try to help you :)

    Enjoy the rest of your day!

    Best regards,
    Yigit

Viewing 10 posts - 1 through 10 (of 10 total)
  • The topic ‘Multilanguage second DSGVO checkbox-text for contactform’ is closed to new replies.