WordPress.org

Ready to get started?Download WordPress

Forums

Captcha
[resolved] The use of the captcha on custom form doesn't work (2 posts)

  1. giwrgos88
    Member
    Posted 1 year ago #

    Hello i'm using the Captcha plugin but i'm having a small issue!!! I have added the code that is required in order to work but i'm having a problem that the Captcha is not been refresh if the user doesn't input it or put it wrong. How i can make it to be refresh and show an error message if the user enters a wrong number?

    I have added this in my custom login page which it is works with Ajax

    [ Moderator Note: Please post code or markup snippets between backticks or use the code button. ]

    <p class="form-cptchleft"><?php if( function_exists( 'cptch_check_custom_form' ) && cptch_check_custom_form() !== true ) echo "Please complete the CAPTCHA." ?></p>
    <p class="form-cptchright"><?php if( function_exists( 'cptch_display_captcha_custom' ) ) { echo "<input type='hidden' name='cntctfrm_contact_action' value='true' />"; echo cptch_display_captcha_custom(); } ?></p>

    and this is when the user press the login button

    elseif (cptch_check_custom_form() !== true)
    {
    
    }

    what action i have to add in the elseif to refresh the captch?
    Thank you

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

  2. bestwebsoft
    Member
    Plugin Author

    Posted 11 months ago #

    Hello giwrgos88,

    "Please follow the instructions below.
    = I would like to add Captcha to custom form on my website. How can I do this? =
    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

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic