I would like to add Captcha to custom form on my website. How can I do this?

Please follow the instructions below.

  1. Install the Captcha plugin and activate it.
  2. Open the file with the form (where you would like to add 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( function_exists( 'cptchpr_display_captcha_custom' ) ) { echo "<input type='hidden' name='cntctfrm_contact_action' value='true' />"; echo cptchpr_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(); } if( function_exists( 'cptchpr_display_captcha_custom' ) ) { echo "<input type='hidden' name='cntctfrm_contact_action' value='true' />"; echo cptchpr_display_captcha_custom(); } ?>

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 ) || ( function_exists( 'cptchpr_check_custom_form' ) && cptchpr_check_custom_form() !== true ) ) echo "Please complete the CAPTCHA.";

or

<?php if ( ( function_exists( 'cptch_check_custom_form' ) && cptch_check_custom_form() !== true ) || ( function_exists( 'cptchpr_check_custom_form' ) && cptchpr_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’.

Have more questions? Submit a request

Comments

  • Avatar
    M Bleau

    Greetings.  I did add the lines of html code that you suggest above to different areas on my Contact Us page and to the Contact-7 form settings on my WordPress Web site.  No captcha is created doing this.  The plugin is active and the only thing it does is to provide a captcha on log in to my admin. page.

     

    Can you please say if there is anything else I should do to create a captcha on my page with the Contact-7 form?  I would love for it to go at the bottom of the form, between the message box and the submit button.

     

    Thank you.

    m

  • Avatar
    BestWebSoft Support Team

    Hi M,

     

    If you mean this plugin -  http://wordpress.org/plugins/contact-form-7/, the functionality to add captcha to contact form 7 is available in the pro version of the plugin -  http://bestwebsoft.com/plugin/captcha-pro/.

     

    Sincerely,

    Support Team

  • Avatar
    Mel

    Hello, I'm trying to add CAPTCHA to Contact Form Pro. I apologize for the fact that I'm not super technical - this may seem like a silly question but what file do I open to insert the lines indicated in step 4? I opened up the contact_form_pro.php but the file took a really long time to open and there were hundreds of lines of text inbetween the php tags. Is this the right file? Thanks for your help!

  • Avatar
    BestWebSoft Support Team

    Hi Mel,

     

    In your case it is necessary to mark checkbox CAPTCHA on the plugin settings page so that captcha could be displayed. You do not need to do anything else.

     

    Sincerely,

    Support Team

  • Avatar
    Mel

    Thank you for your response; however, I have marked CAPTCHA on the plugin settings page but it still doesn't show up. I'm getting this error when I save:

     

    Warning: htmlspecialchars() expects parameter 1 to be string, array given in /home/melskitc/public_html/wp-content/plugins/contact-form-pro/contact_form_pro.php(13) : eval()'d code on line 287

     

    Will this error impact the CAPTCHA showing up (I submitted a ticket about this error yesterday).

     

    Melanie

  • Avatar
    BestWebSoft Support Team

    Dear Mel,

     

    Please update your contact form plugin to the recent version and try again (version 1.16)

     

    Sincerely,

    Support Team

  • Avatar
    Mel

    I just upgraded to the Contact Form Pro** last night**...seems strange and slightly frustrating that what I purchased last night is an old version of the plugin unless version 1.16 was rolled out today. On my plugin list (through Wordpress) I don't see a link to update to 1.16. I've also searched this website/forum. Is there an easily accessible link to get the newest version? I don't want to install another plugin (the updater plugin) if possible. Thank you.

    Mel

  • Avatar
    BestWebSoft Support Team

    Mel,

     

    1) I don't see a link to update to 1.16 - please try to reload the page with plugins (/wp-admin/plugins.php) several times.

    2) By follownig the link you received you always download the latest version of the product.

     

    Sincerely,

    Support Team

  • Avatar
    Mel

    Thank you for your help/responses. I was able to update the contact form pro plugin to 1.16. I emptied the cache and refreshed all the settings in the captcha and the contact form pro plugin...and still, captcha is not showing up on my contact form. The CAPTCHA option is selected under "Settings" in the contact form pro plugin. Is there something else I need to be selecting/doing for the captcha to show up on my contact form?

    Thanks!

    Mel

  • Avatar
    BestWebSoft Support Team

    Dear Mel,

     

    Please provide a link to the page with the contact form, a screenshot of captcha's and contact form's settings.

     

    Sincerely,

    Support Team

  • Avatar
    Mel

    Here is the link to my page with the contact form:

    http://www.melskitchencafe.com/contact-form

    I attached two screenshots, one of the CAPTCHA plugin settings and one of the Advanced settings showing the CAPTCHA checkbox for the Contact form pro plugin.

     

    Thanks.

     

    Mel

  • Avatar
    BestWebSoft Support Team

    Mel,

     

    One of the installed plugins may cause a scripts conflict. Please try to deactivate all the installed plugins except captcha and contact form. Then check if the problem remains the same.

     

    Sincerely,

    Support Team

Please sign in to leave a comment.