Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length

JoomlaTune Support Forum    JComments component    Integration with third-party extensions    Topic: Recaptcha integration
Pages: 1 [2]   Go Down
  Print  
Author Topic: Recaptcha integration  (Read 24920 times)
0 Members and 1 Guest are viewing this topic.
Grinse
Jr. Member
**

Karma: 0
Offline Offline

Posts: 14


« Reply #15 on: June 22, 2011, 00:06:49 »

Ok, I updated my instructions as followed now (should work with JComments 2.2.0.2):

Modifiy jcomments.ajax.php (components/com_jcomments/jcomments.ajax.php):
Replace (lines 254 - 285):
Code:
if ($acl->check('enable_captcha') == 1) {

$captchaEngine = $config->get('captcha_engine', 'kcaptcha');

if ($captchaEngine == 'kcaptcha') {
with:
Code:
$captchaEngine = $config->get('captcha_engine', 'recaptcha');

if ($captchaEngine == 'recaptcha') {

require_once(JCOMMENTS_BASE.DS.'libraries/recaptcha/'.'recaptchalib.php');
$privatekey = "<place your own private key here>";
$resp = null;
$error = null;
$resp = recaptcha_check_answer ($privatekey, $_SERVER["REMOTE_ADDR"], $_POST["recaptcha_challenge_field"], $_POST["recaptcha_response_field"]);
if (!$resp->is_valid) {
$error = $resp->error;
JCommentsAJAX::showErrorMessage($response, 'captcha', JText::_('ERROR_CAPTCHA'), true);
# if (JCommentsCaptcha::attempts() > 3) {
# JCommentsCaptcha::destroy();
# $response->addScript("jcomments.clear('captcha');");
# }
return $response;
}
} elseif ($captchaEngine == 'kcaptcha') {


Modifiy tpl_form.php (components/com_jcomments/tpl/default/tpl_form.php):
Replace (lines 100 - 113):
Code:
if ($this->getVar('comments-form-captcha', 0) == 1) {
$html = $this->getVar('comments-form-captcha-html');
if ($html != '') {
echo $html;
} else {
$link = JCommentsFactory::getLink('captcha');
?>
<p>
<img class="captcha" onclick="jcomments.clear('captcha');" id="comments-form-captcha-image" name="captcha-image" src="<?php echo $link?>" width="121" height="60" alt="<?php echo JText::_('FORM_CAPTCHA'); ?>" /><br />
<span class="captcha" onclick="jcomments.clear('captcha');"><?php echo JText::_('FORM_CAPTCHA_REFRESH'); ?></span><br />
<input class="captcha" id="comments-form-captcha" type="text" name="captcha-refid" value="" size="5" tabindex="6" /><br />
</p>
<?php
                 }
with:
Code:
if ($this->getVar('comments-form-captcha', 0) == 1) {
$captcha = 'recaptcha';
if ($captcha == 'recaptcha') {
$publickey = "<place your own pubilc key here>";
$theme = "white";
$lang = "de";
require_once(JCOMMENTS_BASE.DS.'libraries/recaptcha/'.'recaptchalib.php');
$js = "var RecaptchaOptions = {"."\n";
$js .= "theme : '".$theme."',"."\n";
$js .= "lang : '".$lang."'"."\n";
$js .= "};";
$recaptchaOptions =& JFactory::getDocument();
$recaptchaOptions->addScriptDeclaration($js);
?>
<span id="comments-form-captcha" name="captcha-refid"><?php echo recaptcha_get_html($publickey$error); ?></span>
<?php
} elseif ($captcha == 'kcaptcha') {
$html $this->getVar('comments-form-captcha-html');
if ($html != '') {
echo $html;
} else {
$link JCommentsFactory::getLink('captcha');
?>

<p>
<img class="captcha" onclick="jcomments.clear('captcha');" id="comments-form-captcha-image" name="captcha-image" src="<?php echo $link?>" width="120" height="60" alt="<?php echo JText::_('FORM_CAPTCHA'); ?>" /><br />
<span class="captcha" onclick="jcomments.clear('captcha');"><?php echo JText::_('FORM_CAPTCHA_REFRESH'); ?></span><br />
<input class="captcha" id="comments-form-captcha" type="text" name="captcha-refid" value="" size="5" tabindex="6" /><br />
</p>
<?php
}
}
}

The rest should be the same like I mentioned before.
Logged
thulasi
Newbie
*

Karma: 0
Offline Offline

Posts: 2


« Reply #16 on: July 28, 2011, 16:01:57 »

i am using 2.2.0.2 version of jcomments.

i  try to implement recaptcha by following your instruction. recaptcha is displaying in comment section but i am not able to post new commnet.

please send solution
Logged
Grinse
Jr. Member
**

Karma: 0
Offline Offline

Posts: 14


« Reply #17 on: July 28, 2011, 16:42:08 »

Ok I attached all the needed files here. Just unzip them into your Joomla root directory.

Don't forget to insert your private key and public key inside jcomments.ajax.php and tpl_form.php and to change the theme and language to your needs (at the moment it's set to red and english).

My mod is compatible with Jcomments 2.2.0.2 and uses the Recaptcha PHP Framework 1.11.


Also check your configuration if your user has the needed rights to post comments and check also if you use a template override for Jcomments within your templates folder.

* jcomments_recaptcha-0.2.zip (17.31 KB - downloaded 357 times.)
« Last Edit: July 28, 2011, 16:44:13 by Grinse » Logged
thulasi
Newbie
*

Karma: 0
Offline Offline

Posts: 2


« Reply #18 on: August 02, 2011, 12:58:51 »

i followed ur guidelines but,this is not working for me.
Logged
Grinse
Jr. Member
**

Karma: 0
Offline Offline

Posts: 14


« Reply #19 on: August 02, 2011, 15:41:40 »

Hm, you already made the recaptcha registration for your domain?
I' don't have aclue at the moment what you make wrong.

I tested my previously attached files on a Joomla 1.5.24 and JComments2.2.0.2 installation and it works.

Check your JComments configuration if your user group has rights to write comments and if the captcha use is enabled there.

At the moment you just need to enable captcha in general in the configuration. I used a hardcoded value in the modified files so it's always used recaptcha (and not kcaptcha).

And again: Checkif you have atemplate override in your joomla templates folder where you missed to add the modifications.

At the moment I'mnot home so I can't access my testing enviroment or the servers I added the recaptcha mod to. But I can check it out in a few days.

Greetings Grinse


Btw. There seems to be a recaptcha plugin developed by Smart but he's not publishing it. Smiley
Maybe you can ask him if he will soon (I tried in the past already).

Logged
joerinehart
Newbie
*

Karma: 0
Offline Offline

Gender: Male
Posts: 1



WWW
« Reply #20 on: December 29, 2011, 01:05:34 »

Spent hours on the problem, using every recommended change, but only got a white screen! 

Using:
Joomla Version 1.5.25
com_jcomments_v2.2.0.2.zip
FreeBSD 8.2p5
PHP 5.3.8


Finally decided to remove Jcomments completely, not that it wasn't a great component, but rather, people calling me to inform me my captcha's don't work, and the alternative is insanity Sad

Logged
automatix
Newbie
*

Karma: 0
Offline Offline

Posts: 1


Email
« Reply #21 on: February 11, 2012, 00:48:19 »

Hi, I'm wondering about how to integrate ReCaptcha in JComments

the line

echo recaptcha_get_html($publickey);

outputs this code:

<script src="http://www.google.com/recaptcha/api/challenge?k=my_public_key_here" type="text/javascript"/>
   <noscript>
<iframe src="http://www.google.com/recaptcha/api/noscript?k=my_public_key_here" height="300" width="500" frameborder="0"></iframe>


But after ajax load the javascript not load.

I need know how add some javascript after form load or how execute the javascript included on showform call.

Sorry for my english and thank you for your great component.

Logged
wcpreston
Newbie
*

Karma: 0
Offline Offline

Posts: 1


« Reply #22 on: February 17, 2012, 07:07:18 »

Like the previous poster, I also got a white screen when trying to use this.

I tried editing the files myself and downloaded the files you provided.  I am registered with recaptcha  and put my public and private keys in the two places.  (There are only two places, right?  publickey in one file and privatekey in the other file? I ask this because you say nothing about this in your instructions.)

I am using
Joomla 1.5.20
Jcomments 2.2.0.2

I have nothing in my tpl directory by default.  I have already enabled guest comments.
Logged
karmany
Newbie
*

Karma: 0
Offline Offline

Posts: 3


« Reply #23 on: July 03, 2012, 22:44:07 »

I have created, thanks to Grinse for this post, a code to integrate reCaptcha with JComments. It is a temporary code. I think it may be useful.

All code is free but without warranty of any kind. The entire risk as to the quality and performance of the code is borne by you. JComments is released under the GNU GPL license.

I tried to make sure the source code, for example:
Quote
To retrieve GET/POST request data, Joomla! uses the getVar method of the JRequest class (JRequest::getVar())

To Admin -Hopefully this code will definitely help recaptcha integration with jcomments.

Gracias a todos.

PD. Sorry for not writing the code here. If anyone want to do, would be perfect.

Code and reCaptcha with JComments: http://www.karmany.net/index.php/programacion-web/27-joomla/165-integrar-recaptcha-en-jcomments
Logged
smart
Administrator
Hero Member
*****

Karma: 163
Offline Offline

Gender: Male
Posts: 2161



WWW
« Reply #24 on: July 04, 2012, 15:26:42 »

@karmany: Thank you for solution. The JComments reCAPTCHA plugin is already in testing stage. I am going release it this month. After release we would be able to use reCAPTCHA with JComments without any code change.
Logged

If you use JComments, please post a rating and a review at the Joomla! Extensions Directory
karmany
Newbie
*

Karma: 0
Offline Offline

Posts: 3


« Reply #25 on: July 04, 2012, 21:45:12 »

An excellent work!!. An excellent Work and support. One question, jcomments is programed by only one person?
Logged
smart
Administrator
Hero Member
*****

Karma: 163
Offline Offline

Gender: Male
Posts: 2161



WWW
« Reply #26 on: July 04, 2012, 21:48:04 »

An excellent work!!. An excellent Work and support. One question, jcomments is programed by only one person?
Yes, this extension created, developed and supported (usually) by one person. Sometime my friends help me to support. But all code written by me Wink
Logged

If you use JComments, please post a rating and a review at the Joomla! Extensions Directory
Paul12
Newbie
*

Karma: 0
Offline Offline

Posts: 1


Email
« Reply #27 on: August 23, 2012, 04:28:45 »

Is there any chance of the reCaptcha plugin coming soon?  I know you had indicated it would be released in July.  Thanks.
Logged
petunia
Newbie
*

Karma: 0
Offline Offline

Posts: 7


« Reply #28 on: December 31, 2012, 04:49:45 »

where i can found recaptcha plugin??

thanks  Roll Eyes
Logged
crowcreekc
Newbie
*

Karma: 0
Offline Offline

Posts: 1


« Reply #29 on: January 23, 2013, 01:47:39 »

Any news on when the Recaptcha plugin will be available?  I use Recaptcha for other components on my site and would really like to use JComments. 

Is it to late to beta test the one in development?
Logged
Pages: 1 [2]   Go Up
  Print  
JoomlaTune Support Forum    JComments component    Integration with third-party extensions    Topic: Recaptcha integration
 
Jump to: