WordPress.org

Support

Support » Plugins and Hacks » [Resolved] Doesn't work on custom form? Here a dirty workaround

[Resolved] Doesn't work on custom form? Here a dirty workaround

  • agenciesFirst
    Participant

    @agenciesfirst

    This code in the function.php of your theme ->
    if( function_exists( ‘cptch_check_custom_form’ ) && cptch_check_custom_form() !== true ) echo “<p style=\”display: none;\”>Please complete the CAPTCHA.</p>”;

    —–

    This code in your form tag from your contact form ->

    <? if( function_exists( ‘cptch_display_captcha_custom’ ) ) {
    echo “<input type=’hidden’ name=’cntctfrm_contact_action’ value=’true’ />”;
    if( function_exists( ‘cptch_check_custom_form’ ) && cptch_check_custom_form() !== true ) echo $cptch_options[‘cptch_label_form’];
    echo cptch_display_captcha_custom(); }
    ?>

    I displayed the “Label” from the Admin Site: echo $cptch_options[‘cptch_label_form’]

    Try it out, its working fine for me under Multisite 🙂

    Thanks a lot.

    http://wordpress.org/extend/plugins/captcha/

Viewing 1 replies (of 1 total)
  • Plugin Author bestwebsoft
    Participant

    @bestwebsoft

    Hello agenciesFirst,

    Here is the right way of adding the captcha to the custom form:
    1. Install the Captcha plugin and activate it.
    2. Open the file with the form (where you would like to add the captcha to).
    3. Find a place to insert the code for the captcha output.
    4. Insert the necessary lines:

    if( function_exists( 'cptch_display_captcha_custom' ) ) { echo "<input
    type='hidden' name='cntctfrm_contact_action' value='true' />"; echo
    cptch_display_captcha_custom() } ;

    If the form is HTML you should insert the line with the PHP tags:

    <?php
    if( function_exists( 'cptch_display_captcha_custom' ) ) { echo
    "<input type='hidden' name='cntctfrm_contact_action' value='true'
    />"; echo cptch_display_captcha_custom(); } ?>

    5. Then you should add the lines to the function of the entered data checking

    if( function_exists( 'cptch_check_custom_form' ) &&
    cptch_check_custom_form() !== true ) echo "Please complete the
    CAPTCHA."

    or

    <?php if( function_exists(
    'cptch_check_custom_form' ) && cptch_check_custom_form() !==
    true ) echo "Please complete the CAPTCHA." ?>

    You could add this line to the variable and display this variable in the
    required place instead of echo "Please complete the CAPTCHA.". If
    there is a variable (responsible for the errors output) in the check
    function, this phrase can be added to this variable. If the function
    returns ‘true’, it means that you have entered captcha properly. In all
    other cases the function will return ‘false’.

    Kind regards,
    Support Team

Viewing 1 replies (of 1 total)
  • The topic ‘[Resolved] Doesn't work on custom form? Here a dirty workaround’ is closed to new replies.