Viewing 23 posts - 1 through 23 (of 23 total)
  • Author
    Posts
  • #1029380

    I have a question. I would like to include Google Captcha in the Enfold contact form. Is that possible? If yes how?

    #1030436

    Hey frasche,

    Here are some threads to consider:
    https://kriesi.at/support/topic/google-recaptcha-and-enfold-contact-form/#post-830898
    https://kriesi.at/support/topic/google-recaptcha-and-enfold-contact-form/page/2/

    If you need further assistance please let us know.
    Best regards,
    Victoria

    #1030654

    Sorry, i read and read and read. But I don’t understand, what I have to do. Can you give me a simple answer, what I have to do?
    I would like to say, that I have now some question to your support. But the Kriesi support is really not good. I already bought 9 licenses from Enfold and I expect a support that also helps and does not just refer to other posts.

    #1032392

    Hi,

    I would like to apologize for that. Please create a reCAPTCHA key here:

    // https://www.google.com/recaptcha/admin

    And then add this code in the functions.php file.

    // https://kriesi.at/support/topic/starting-to-receive-spam-enquiries-from-contact-form-on-website/#post-817676

    You have to add the reCAPTCHA public key on this line:

    var publickey = 'YOUR PUBLIC API KEY';
    

    Best regards,
    Ismael

    #1032399

    Hello Ismael,
    I tried exactly this way. But it did not work. I use Enfold 4.5 What am I doing wrong? I change YOUR PUBLIC API KEY with my Google Captcha Public key, but what i have to do with my secret key?
    Is the code to be put in a special place in the file “functions.php”?
    Do I have to install a special plugin also?

    Thanks for your help
    Frank

    #1032828

    Hi,

    My bad. This is the updated reCAPTCHA snippet using the secret key.

    // EDITED: https://github.com/KriesiMedia/enfold-library/tree/master/integration%20plugins/Enfold/Enfold%20G%20Recaptcha/enfold-recaptcha

    Add the public key on this line:

    var captcha = jQuery("
    <p data-sitekey='PUBLIC KEY HERE' data-callback='onloadCallback' id='reCAPTCHAV2'></p>
    
    ");
    

    And the secret key here:

    $secret = 'SECRET KEY HERE';
    

    You can create your own options panel and save the keys in your database if you don’t want to put them directly in the snippet.

    Best regards,
    Ismael

    #1032958

    Hi Ismael,
    Now it almost works. The problem now is that when the captcha is clicked, the page jumps back to the beginning.
    Can you still solve this? Then it would be perfect.I sent you the link from the page in “Private Content” so you can see and test the problem.

    #1033830

    Hi,

    Glad it’s working. To fix the “jump” issue, look for this line:

    window.location.hash = grecaptcha.getResponse();
    

    Below, add this code:

    
    if( history.pushState ) {
        history.pushState(null, null, window.location.hash);
    }
    else {
        location.hash = window.location.hash;
    }
    

    Best regards,
    Ismael

    #1033925

    Hi Ismael,
    i put your new code snipet now in my functions.php

    var onSuccessfullCallback = function(success) {
    window.location.hash = grecaptcha.getResponse();
    if( history.pushState ) {
    history.pushState(null, null, window.location.hash);
    }
    else {
    location.hash = window.location.hash;
    }

    But it’s still the same problem (when the captcha is clicked, the page jumps back to the beginning)
    I think, i put the code correct. What’s going wrong now?

    Regards Frank

    #1033927
            createCaptcha();
       
            var onloadCallback = function() {
                grecaptcha.render('reCAPTCHAV2', {
                    'sitekey' : publickey,
                    'callback' : 'onSuccessfullCallback'
                });
            };
       
            var onSuccessfullCallback = function(success) {
                window.location.hash = grecaptcha.getResponse();
    			if( history.pushState ) {
    			history.pushState(null, null, window.location.hash);
    			}
    		else {
    			location.hash = window.location.hash;
    		}
    #1034310

    Hi,

    Thanks for the update.

    The reCAPTCHAv2 has been deprecated. You have to use v3 now and generate a new key.

    // https://www.google.com/recaptcha/

    This is the updated code: https://pastebin.com/qrWqXP59

    The new script will no longer force the document to jump back on top. Again, you have replace the placeholders with your public and secret key.

    Doc: https://developers.google.com/recaptcha/docs/v3

    Best regards,
    Ismael

    #1034324

    Hello Ismael,
    I have now generated my public and secret key in Captcha V3. The new code you gave me (in my private content is a link to the website) does not work either.
    The code does not show a captcha symbol. Do you see that in this picture?
    Contact form without Recaptcha and button
    This is not the newest Version of Enfold. Enfold 4.5 see picture at the next post.

    I have entered the public key V3 in the line var key = ‘XXX’ and also in the line under the function avia_register_reCAPTCHAV2_scripts (). Then I entered the V2 key in this line, but unfortunately that does not work either.

    Here comes the code:
    EDITED: Please use the plugin instead: https://github.com/KriesiMedia/enfold-library/tree/master/integration%20plugins/Enfold/Enfold%20G%20Recaptcha/enfold-recaptcha

    What do I wrong? Normally it’s easy with your description but it still not work.

    Frank

    • This reply was modified 6 years, 1 month ago by frasche.
    #1034347

    In Enfold 4.5 comes the Captcha on the right side.

    • This reply was modified 6 years, 1 month ago by frasche.
    #1034423

    Hey!

    Thanks for the update.

    Can you give us access to the dashboard and your file server? I would like to test the new scripts. Please provide the WP and FTP details in the private field.

    Best regards,
    Ismael

    #1034445

    Hi Ismael,
    the datas are in the Private Content

    #1035435

    Hi,

    I would like to apologize for the delay. I managed to display the reCAPTCHA widget but there’s an error. Do you have the old v2 key? Please post it in the private field.

    I disabled the modification temporarily.

    Best regards,
    Ismael

    #1035447

    Yes, here comes the keys:

    #1035472

    Hi,

    Thanks for the info. It’s working now. (see private field for the final modification)

    Best regards,
    Ismael

    #1035483

    Fantastic! But how can I do that for my next project?
    I have to modifiy the functions.php in ENFOLD same as your version? And than i have to create a function.php in ENFOLD-CHILD same as your version? Thats it?

    #1035823

    I’ve got the same problem, changed all in the child functions.php but something is missing. What do you mean with changings in the main functions.php (not the cild one) ?

    Regards
    robert

    #1035963

    Hi,

    You can copy that code on the child theme’s functions.php file for your next project. Just replace the site and secret key with your own. You have to use reCAPTCHA v2 instead of v3.


    @robmarek
    : Did you change the keys on these lines?

    Site key: (line 06)

    var key = 'SITE KEY HERE';
    

    Site key: (line 101)

    $key = 'SITE KEY HERE';
    

    Secret: (line 76)

    $secret = 'SECRET KEY HERE';
    

    Best regards,
    Ismael

    #1036369

    Hi Ismael,
    I would like to say that you are the Number 1 of KRIESI support. You really help and it’s a pleasure to ask you something. Because you do everything, to found a solution for the Customer Problem.
    I hope that next time you’re the one who takes care of my problem. Because some of your colleagues do not take support as seriously as you do.
    Many Thanks
    Frank

    #1036461

    Hi,

    Thank you for the kind words. I sure hope I can help you again next time.

    Have a nice day.

    Best regards,
    Ismael

Viewing 23 posts - 1 through 23 (of 23 total)
  • The topic ‘How can I put in the Google Captcha in the Enfold contact form’ is closed to new replies.