Forum for discussing general topics related to Couch.
17 posts Page 1 of 2
Is there any guidance about incorporating this addon into a 'contact' page please?

I've updated couch/config.php with my reCaptcha keys. Looking through the forums, there is reference to config.php in the addons/recaptcha folder (if I understand it correctly). I wondered if V2.1 had obviated that addons/recaptcha/config.php and incorporated the keys into couch/config.php?

Do I simply need to add
Code: Select all
require_once( K_COUCH_DIR.'addons/recaptcha/recaptcha.php' );
in the 'contact' page code? If so, how do I specify where the reCaptcha appears on the page?

TIA

Hmm! Now 5th Feb and no comments. Surprising in this forum where responses are usually fast and extremely helpful. Is the topic of no interest to most Couchcms users?
Hi,

Please try following the three steps below -

1. The addon ships with Couch but it not active by default. To activate it, please place the following line in 'couch/addons/kfunctions.php' file (in case this file is not present at that location, rename the 'kfunctions.example.php' to 'kfunctions.php')
Code: Select all
require_once( K_COUCH_DIR.'addons/recaptcha/recaptcha.php' );

2. Get the required key pair from Google and enter them in 'couch/config.php' file (already has a setting for the keys) -
Code: Select all
    // 27.
    // Google reCAPTCHA API Keys.
    // To use this captcha service, you need to sign up for an API key pair for your site.
    // Please visit 'https://www.google.com/recaptcha/admin' to get the keys and enter them below.
    define( 'K_RECAPTCHA_SITE_KEY', '6LeIxAcTAAAAAJcZVRqyHh71UMIEGNQ_MXjiZKhI' );
    define( 'K_RECAPTCHA_SECRET_KEY', '6LeIxAcTAAAAAGG-vFI1TnRWxMZNFuojJ4WifJWe' );

3. Finally, in the form where you wish to use the recaptcha (e.g. the contact template in your case), define the input as follows -
Code: Select all
<cms:input name='recaptcha_test' type='recaptcha'/>

Hope this helps.
Thanks for the reply. I followed the advice but the recaptcha appears as shown.
recaptcha.gif
recaptcha.gif (5.69 KiB) Viewed 2843 times
To remove the warning that is caused by using the default key please go to the recaptcha admin (https://www.google.com/recaptcha/admin/) and register an own key for use in your site. Next, paste obtained keys into CouchCMS's config.php file in the appropriate places as mentioned by @KK.
trendoman wrote: To remove the warning that is caused by using the default key please go to the recaptcha admin (https://www.google.com/recaptcha/admin/) and register an own key for use in your site. Next, paste obtained keys into CouchCMS's config.php file in the appropriate places as mentioned by @KK.

Sorry, I made the change on my dev PC but forgot to upload it! :oops:
Old age doesn't come on its own :cry:

Once again, thanks a million!
trendoman wrote: To remove the warning that is caused by using the default key please go to the recaptcha admin (https://www.google.com/recaptcha/admin/) and register an own key for use in your site. Next, paste obtained keys into CouchCMS's config.php file in the appropriate places as mentioned by @KK.

Everything now seems to be working fine - many thanks. The only thing I'd like is to have a red prompt appear if the captcha hasn't been activated. At the moment the form just seems to reload without any comment - unless I've missed something?
Could you please illustrate the "red prompt"?
trendoman wrote: Could you please illustrate the "red prompt"?

Well, any 'required' field not completed on the contact form which hasn't been filled, shows a red text message saying it's required. Doesn't happen if the captcha isn't activated.
I wonder what happens if input was given a 'required' parameter?
Code: Select all
<cms:input name='recaptcha_test' type='recaptcha' required='1'/>
trendoman wrote: I wonder what happens if input was given a 'required' parameter?
Code: Select all
<cms:input name='recaptcha_test' type='recaptcha' required='1'/>

Unfortunately, nothing seems to change.
17 posts Page 1 of 2