Keyword

[Fixed] Google reCAPTCHA v2 bug on reload & Support Language

  • Abdulaziz Mierza
  • Abdulaziz Mierza's Avatar Topic Author
  • Offline
  • New Member
More
7 years 11 months ago - 7 years 11 months ago #153927 by Abdulaziz Mierza
Hi Everyboy,
This Topis for improve our beautiful K2 :
1-bug in reCAPTCHA v2 on release version of K2 which is :
After accept comment & reload page >> reCAPTCHA not will shown
2-Add Suuport Joomla Language > for example if you using Germany language for joomla , its will show reCAPTCHA Germany from Google

PLease Replace these code in (Note this example only for comments, you can replace for other) :
[your joomla folder]/components/com_k2/views/item/view.html.php

FIND :
if($params->get('recaptchaV2')) {
							$document->addScript('https://www.google.com/recaptcha/api.js?onload=onK2RecaptchaLoaded&render=explicit');
							$js = 'function onK2RecaptchaLoaded(){grecaptcha.render("recaptcha", {"sitekey" : "'.$item->params->get('recaptcha_public_key').'"});}';
							$document->addScriptDeclaration($js);
							$this->recaptchaClass = 'k2-recaptcha-v2';
						}

REPLACE WITH :
if($params->get('recaptchaV2')) {
							$document->addScript('https://www.google.com/recaptcha/api.js?hl=' . JFactory::getLanguage()
						->getTag() . '&onload=onK2RecaptchaLoaded&render=explicit');
							$js = 'function onK2RecaptchaLoaded(){grecaptcha.render("recaptcha", {"sitekey" : "'.$item->params->get('recaptcha_public_key').'"});}
							$K2(window).load(function() {
								onK2RecaptchaLoaded();
							});
							';
							$document->addScriptDeclaration($js);
							$this->recaptchaClass = 'k2-recaptcha-v2';
						}

NOTE :
YOU CAN USED FOR ANOTHER FILE LIKE : [your joomla folder]/plugins/system/k2/k2.php


You can download the PHP file from link (ONLY FOR [your joomla folder]/components/com_k2/views/item/view.html.php):
www.dropbox.com/s/etao09vvx2cb5cl/view.html.php?dl=0
Last edit: 7 years 11 months ago by Abdulaziz Mierza.

Please Log in or Create an account to join the conversation.

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
7 years 11 months ago #153942 by Krikor Boghossian
Replied by Krikor Boghossian on topic [Fixed] Google reCAPTCHA v2 bug on reload & Support Language
Hello Abdulaziz,

Thank you for sharing this, can you make a PR in Github so we evaluate this?

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

Please Log in or Create an account to join the conversation.

  • Abdulaziz Mierza
  • Abdulaziz Mierza's Avatar Topic Author
  • Offline
  • New Member
More
7 years 11 months ago #153952 by Abdulaziz Mierza
Hi Krikor,
Sure
Follow the link github.com/mierza/Joomla-K2

Please Log in or Create an account to join the conversation.

More
7 years 6 months ago #157795 by STEPHAN HERBY
Hi K2 afficionados :)
Just a little thank to Abdulaziz who helped me make working my Captcha with this topic :)

Please Log in or Create an account to join the conversation.

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
7 years 6 months ago #157806 by Krikor Boghossian
Replied by Krikor Boghossian on topic [Fixed] Google reCAPTCHA v2 bug on reload & Support Language
Yes, it was very nice of him to contribute.

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

Please Log in or Create an account to join the conversation.


Powered by Kunena Forum