Hello Antonio.
.- Access the page and register your domain, take note of the data.
.- Copy this code in the header.tpl file that you will find in the root of your installation ( Public_html ), add it in the first line:
.- Copy the following code in /themes -> your_template -> contact-form.tpl (which is the file that shows the html of the contact form)
You have to modify here the password of the site that Google provides you with the password that you obtained when you registered in Captcha
Finally, access controllers -> front -> ContactController.php (which is the file that performs the contact form checks) and look for the following:
else if (!empty($fileAttachment) && !in_array( Tools::strtolower(substr($fileAttachment, -4)), $extension) && !in_array( Tools::strtolower(substr($fileAttachment, -5)), $extension)) $this->errors = Tools::displayError(‘Bad file extension’); else
Below that line add the following:
else if (!($gcaptcha = (int)(Tools::getValue(‘g-recaptcha-response’)))) $this->errors = Tools::displayError(‘Captcha not verified’);
It would look like this:
else if (!empty($fileAttachment) && !in_array( Tools::strtolower(substr($fileAttachment, -4)), $extension) && !in_array( Tools::strtolower(substr($fileAttachment, -5)), $extension)) $this->errors = Tools::displayError(‘Bad file extension’); else if (!($gcaptcha = (int)(Tools::getValue(‘g-recaptcha-response’)))) $this->errors = Tools::displayError(‘Captcha not verified’); else
Note: remember to make a copy of the files before making any changes.
All the best
Answered : 02/13/2018 9:38 am