• Resolved mark737

    (@mark737)


    Hi, I’d like to include a Google Captcha shortcode for the register form, instead of the premium captcha. My code:

    [restricted block_logged_in=’Yes’ no_message=’Yes’][register][bws_google_captcha][/restricted]

    However, the google captcha is included after the </form> tag.

    Is there a way to reliably include it between the form tags, preferably with php?

    Thanks.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Contributor etoilewebdesign

    (@etoilewebdesign)

    Hi Mark737,

    As we never tried adding Google Captcha inside register form. We are not sure if it will work or not. But the standard way to include a shortcode directly in the PHP is to use the do_shortcode method that WordPress offers. They explain it here: https://developer.ww.wp.xz.cn/reference/functions/do_shortcode/.

    Thank you

    Thread Starter mark737

    (@mark737)

    Thanks, I did this with jquery html() (same as javascript innerHTML) to put the shortcode there, seems to work. Action/filter functionality like WP uses would have been good in this situation.

    Thread Starter mark737

    (@mark737)

    FYI, I put this after the_content() in my page-register.php file, using the BestWebSoft plugin for the google captcha shortcode.

    <script>
    jQuery( document ).ready(function() {
    googlecaptcha_content = ‘<?php
    $captcha_shortcode = do_shortcode(“[bws_google_captcha]”);
    $captcha_shortcode = str_replace( array(“\n”,”\r”,”\t”), “”, $captcha_shortcode);
    echo $captcha_shortcode;
    ?>’;
    jQuery(‘#ewd-feup-register-input-11’).html(googlecaptcha_content);
    });
    </script>

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Google Captcha in register’ is closed to new replies.