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: JComments 3.0.0 Recaptcha Integration Joomla 3.1.5
Pages: [1] 2 3   Go Down
  Print  
Author Topic: JComments 3.0.0 Recaptcha Integration Joomla 3.1.5  (Read 58948 times)
0 Members and 1 Guest are viewing this topic.
stopyz
Newbie
*

Karma: 0
Offline Offline

Posts: 9


Email
« on: October 05, 2013, 17:26:27 »

METHOD FOR    Joomla 3.0 -> JComments 3.0.0 TESTED ON JOOMLA 3.1.5  --> OCTOBER 2013



UPGRADE WIKI FOR JCOMMENTS RECAPTCHA INTEGRATION WITH JOOMLA 3.0 AND JCOMMENTS V 3.0.0


IMPORTANT


 Please Note this for Jcomments Recaptcha Integration


 Joomla 3.0 -> JComments 3.0.0

 Joomla 2.5 -> JComments 2.3.0

 Joomla 1.7 -> JComments 2.2.0.2  *NOT TESTED*

 Joomla 1.5 -> JComments 2.2.0.2  *NOT TESTED*


Hi everybody, and sorry for my poor english, I'm French   Grin

I spend lot of time to find a tricks with this  Lips sealed captha !!! And find a good and stable solution.

Last method don't work at all with new joomla versions, and new JComments version (3.0.0 admin folders etc ...)

the following method insert JOOMLA recaptcha native module in GNU jcomments code

 Cheesy  So DON'T FORGET to insert you private and public key (or susbscribe) in your Joomla Panel administrator site (extension/plugin-manager/Captcha - ReCaptcha -> go to parameters en insert yours keys, you can select differents recaptcha theme)

OK let's go ... Wink


METHOD FOR    Joomla 3.0 -> JComments 3.0.0 TESTED ON JOOMLA 3.1.5  --> OCTOBER 2013


STEP 1


go to : administrator\components\com_jcomments\models\forms\settings.xml at line 398

REPLACE

Code:
<field
                name="captcha_engine"
                type="jcommentscaptcha"
                class="inputbox"
                default="recaptcha"
                label="AP_FORM_FIELD_CAPTCHA"
                description="">
            <option value="kcaptcha">KCAPTCHA</option>
</field>


WITH THIS

Code:
<field
                name="captcha_engine"
                type="jcommentscaptcha"
                class="inputbox"
                default="recaptcha"
                label="AP_FORM_FIELD_CAPTCHA"
                description="">
            <option value="kcaptcha">KCAPTCHA</option>
 <option value="recaptcha">RECAPTCHA</option>
        </field>


STEP 2

go to your Joomla Panel administrator site -> Component > JComment > Settings > Layout

in CAPTCHA inputbox you can now select reCaptcha (scroll down or zoom)

STEP 3

go to : components\com_jcomments\tpl\default\tpl_form.php at line 126

REPLACE


Code:
<?php
}

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>
<span>
<img class="captcha" onclick="jcomments.clear('captcha');" id="comments-form-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 />
</span>
</p>
<?php

WITH THIS

Code:
<?php
}

if ($this->getVar('comments-form-captcha'0) == 1) {
            
$html $this->getVar('comments-form-captcha-html','kcaptcha');
            if (
$html == 'kcaptcha') {
                
$link JCommentsFactory::getLink('captcha');
?>

<p>
    <span>
        <img class="captcha" onclick="jcomments.clear('captcha');" id="comments-form-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 />
    </span>
</p>
<?php
            
} else {
                
$link JCommentsFactory::getLink('captcha');
                                            
JPluginHelper::importPlugin('captcha');
                                            
$dispatcher JDispatcher::getInstance();
                                            
$dispatcher->trigger('onInit','dynamic_recaptcha_1');
?>

<p>
    <span>
        <div id="dynamic_recaptcha_1"></div>
    </span>
</p>
<?php
            
}
        }
?>

STEP 4

go to : components\com_jcomments\jcomments.ajax.php at line 227

REPLACE

Code:
if ($acl->check('enable_captcha') == 1)
{                    
    $captchaEngine = $config->get('captcha_engine', 'kcaptcha');
    if ($captchaEngine == 'kcaptcha')
    {
        require_once( JCOMMENTS_BASE.DS.'jcomments.captcha.php' );
        if (!JCommentsCaptcha::check($values['captcha_refid']))
        {
            self::showErrorMessage(JText::_('ERROR_CAPTCHA'), 'captcha');
            JCommentsCaptcha::destroy();
            $response->addScript("jcomments.clear('captcha');");
            return $response;
        }
    }
    else
    {
        $result = JCommentsEvent::trigger('onJCommentsCaptchaVerify', array($values['captcha_refid'], &$response));
        // if all plugins returns false
        if (!in_array(true, $result, true))
        {
            self::showErrorMessage(JText::_('ERROR_CAPTCHA'));
            return $response;
        }
    }
}

WITH THIS

Code:
if ($acl->check('enable_captcha') == 1)
{
    $captchaEngine = $config->get('captcha_engine', 'kcaptcha');
                            
    if ($captchaEngine == "recaptcha")
    {                                                                                            
        $post = JRequest::get('post');  
        JPluginHelper::importPlugin('captcha');
        $dispatcher = JDispatcher::getInstance();
        $resp = $dispatcher->trigger('onCheckAnswer',$post['recaptcha_response_field']);                                                                                                            
        
        if(!$resp[0]){
            self::showErrorMessage(JText::_('ERROR_CAPTCHA'), 'captcha');
            $response->addScript("Recaptcha.reload()");
            return $response;
        }
        else
        {
            $response->addScript("Recaptcha.reload()");
        }
    }
else if ($captchaEngine == 'kcaptcha')
    {
        require_once( JCOMMENTS_SITE.'jcomments.captcha.php' );
        if (!JCommentsCaptcha::check($values['captcha_refid']))
        {
            self::showErrorMessage(JText::_('ERROR_CAPTCHA'), 'captcha');
            JCommentsCaptcha::destroy();
            $response->addScript("jcomments.clear('captcha');");
            return $response;
        }
    }

STEP 5



FINISH and you can apply css modification. It will be looks like this:

 http://icwtrust.com/index.php/ios/ipa/118-sonic-4-the-hedgehog-episode-1-ipa

Tested on IE 7 & 8 - Chrome - Firefox - Opera

Thanks  - Please report any bug or problem for comunauty -

mail : incloudwetrust@gmail.com - site web : http://icwtrust.com/
« Last Edit: October 25, 2013, 19:30:52 by stopyz » Logged
smart
Administrator
Hero Member
*****

Karma: 187
Offline Offline

Gender: Male
Posts: 1883



WWW
« Reply #1 on: October 07, 2013, 17:39:56 »

Thank you for sharing the solution. In neares time I'm going to release the JComments ReCAPTCHA plugin. It has been created more than year ago but wasn't released because some technical reasons. My previous solution has been using ReCAPTCHA lib to show and check CAPTHCA value because old Joomla versions had hadn't ReCAPTCHA support. You solution has been using built-in ReCAPTCHA plugin and this seems more correct. I've already modified my plugin and seems all works fine. The main difference between this modification and my plugin - plugin doesn't require any code change - just install and publish and this is more easy for users. Contact me if you're interested in testing.
Logged

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

Karma: 1
Offline Offline

Posts: 3


« Reply #2 on: October 23, 2013, 19:03:29 »

Hello!

This solution is not working for me.

Everything is fine (I see the ReCaptcha), but when I try to insert a new comment in an article I only see a quick ajax loader that disappear after few milliseconds. And the comment is not inserted.
I do not receive errors.

Thanks!
Logged
stopyz
Newbie
*

Karma: 0
Offline Offline

Posts: 9


Email
« Reply #3 on: October 24, 2013, 04:11:47 »

Hi,

What's your joomla version & Jcomments versions please, did you have a framework with joomla, your site is online ?

Find, Copy & Past correctly. Verify ajax past file and joomla recaptcha settings, your problem looks like wrong recaptcha. when i tested recaptcha, I have the same problem when i write a wrong recaptcha, and I do not receive errors message text "wrong recaptcha.
Logged
Pepozzo
Newbie
*

Karma: 1
Offline Offline

Posts: 3


« Reply #4 on: October 24, 2013, 15:16:13 »

I'm using Joomla! 2.5.14 (I know this tutorial is for J! 3.x but I tried).
JComment version 3.0.

My site is online and you can browse an article at this address: h**p://www.virtuscampegine.info/55-amatori/715-b
Logged
stopyz
Newbie
*

Karma: 0
Offline Offline

Posts: 9


Email
« Reply #5 on: October 25, 2013, 04:45:38 »

METHOD FOR    Joomla 2.5 -> JComments 2.3.0




Ok, it's normal that doesn't working with Joomal 2.5  Grin

IMPORTANT


 Please Note this for Jcomments Recaptcha Integration


 Joomla 3.0 -> JComments 3.0.0

 Joomla 2.5 -> JComments 2.3.0

 Joomla 1.7 -> JComments 2.2.0.2  *NOT TESTED*

 Joomla 1.5 -> JComments 2.2.0.2  *NOT TESTED*

Ok try this, it doesn't my work, but integrate Recaptacha native joomla 2.5 with JComments 2.3.0 (same last method)
(work of Carlos M. Caméra , by Gnumla.com)
I Translate & Modify some errors  Roll Eyes :

METHOD FOR    Joomla 2.5 -> JComments 2.3.0


STEP 1

go to : administrator/components/com_jcomments/admin.jcomments.php at line 1066


REPLACE

Code:
$captcha[] = JCommentsHTML::makeOption('kcaptcha', 'KCAPTCHA');

WITH THIS

Code:
$captcha[] = JCommentsHTML::makeOption('kcaptcha', 'KCAPTCHA');
$captcha[] = JCommentsHTML::makeOption('recaptcha', 'RECAPTCHA');

STEP 2

go to your Joomla Panel administrator site -> Component > JComment > Settings > Layout

in CAPTCHA inputbox you can now select reCaptcha (scroll down or zoom)

STEP 3

go to : components/com_jcomments/tpl/default/tpl_form.php at line 114


REPLACE


Code:
<?php
}
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>
    <span>
        <img class="captcha" onclick="jcomments.clear('captcha');" id="comments-form-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 />
    </span>
</p>
<?php
            
}
        }
?>

WITH THIS

Code:
<?php
}
if (
$this->getVar('comments-form-captcha'0) == 1) {
            
$html $this->getVar('comments-form-captcha-html','kcaptcha');
            if (
$html == 'kcaptcha') {
                
$link JCommentsFactory::getLink('captcha');
?>

<p>
    <span>
        <img class="captcha" onclick="jcomments.clear('captcha');" id="comments-form-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 />
    </span>
</p>
<?php
            
} else {
                
$link JCommentsFactory::getLink('captcha');
                                            
JPluginHelper::importPlugin('captcha');
                                            
$dispatcher JDispatcher::getInstance();
                                            
$dispatcher->trigger('onInit','dynamic_recaptcha_1');
?>

<p>
    <span>
        <div id="dynamic_recaptcha_1"></div>
    </span>
</p>
<?php
            
}
        }
?>

STEP 4

go to : components\com_jcomments\jcomments.ajax.php at line 275


REPLACE

Code:
if ($acl->check('enable_captcha') == 1)
{                    
    $captchaEngine = $config->get('captcha_engine', 'kcaptcha');
    if ($captchaEngine == 'kcaptcha')
    {
        require_once( JCOMMENTS_BASE.DS.'jcomments.captcha.php' );
        if (!JCommentsCaptcha::check($values['captcha_refid']))
        {
            self::showErrorMessage(JText::_('ERROR_CAPTCHA'), 'captcha');
            JCommentsCaptcha::destroy();
            $response->addScript("jcomments.clear('captcha');");
            return $response;
        }
    }
    else
    {
        $result = JCommentsEvent::trigger('onJCommentsCaptchaVerify', array($values['captcha_refid'], &$response));
        // if all plugins returns false
        if (!in_array(true, $result, true))
        {
            self::showErrorMessage(JText::_('ERROR_CAPTCHA'));
            return $response;
        }
    }
}

WITH THIS

Code:
if ($acl->check('enable_captcha') == 1)
{
    $captchaEngine = $config->get('captcha_engine', 'kcaptcha');
                            
    if ($captchaEngine == "recaptcha")
    {                                                                                            
        $post = JRequest::get('post');  
        JPluginHelper::importPlugin('captcha');
        $dispatcher = JDispatcher::getInstance();
        $resp = $dispatcher->trigger('onCheckAnswer',$post['recaptcha_response_field']);                                                                                                            
        
        if(!$resp[0]){
            self::showErrorMessage(JText::_('ERROR_CAPTCHA'), 'captcha');
            $response->addScript("Recaptcha.reload()");
            return $response;
        }
        else
        {
            $response->addScript("Recaptcha.reload()");
        }
    }elseif ($captchaEngine == 'kcaptcha')
    {
        require_once( JCOMMENTS_BASE.DS.'jcomments.captcha.php' );
        if (!JCommentsCaptcha::check($values['captcha_refid']))
        {
            self::showErrorMessage(JText::_('ERROR_CAPTCHA'), 'captcha');
            JCommentsCaptcha::destroy();
            $response->addScript("jcomments.clear('captcha');");
            return $response;
        }
    } else
    {
        $result = JCommentsEvent::trigger('onJCommentsCaptchaVerify', array($values['captcha_refid'], &$response));
        // if all plugins returns false
        if (!in_array(true, $result, true))
        {
            self::showErrorMessage(JText::_('ERROR_CAPTCHA'));
            return $response;
        }
    }
}

STEP 5

FINISH and you can apply css modification. AND DON'T FORGET to insert you private and public key (or susbscribe) in your Joomla Panel administrator site (extension/plugin-manager/Captcha - ReCaptcha -> go to parameters en insert yours keys, you can select differents recaptcha theme)


PLEASE REPORT ME IF THIS METHOD WORKING. THANKS.

P.S ( To admin no problem for testing your app  Wink your welcome. And please change height of preview post, 20 px it's simply horrible  Embarrassed please 200 px or 250 px it's better, Thanks a lot )
Code:
<td id="preview_subject">Re: JComments 3.0.0 Recaptcha Integration Joomla 3.1.5</td>
</tr>
<td class="windowbg" width="100%">
<div id="preview_body" class="post" style="height: 200px;"><!-- Change 20px to 200px or 250px -->
« Last Edit: October 25, 2013, 19:31:07 by stopyz » Logged
stopyz
Newbie
*

Karma: 0
Offline Offline

Posts: 9


Email
« Reply #6 on: October 25, 2013, 05:07:51 »

I'm using Joomla! 2.5.14 (I know this tutorial is for J! 3.x but I tried).
JComment version 3.0.

My site is online and you can browse an article at this address: http://www.virtuscampegine.info/55-amatori/715-b


@ Pepozzo

Try to modify ajax.php @ line 275 and not 227


I don't think Joomla 2.5 / Jcomments 3.0.0 is a good solution but. if solution not work, you can try to remove JComments 3.0.0 & share JComments 2.3.0

Good Luck.
« Last Edit: October 25, 2013, 05:09:51 by stopyz » Logged
Pepozzo
Newbie
*

Karma: 1
Offline Offline

Posts: 3


« Reply #7 on: October 25, 2013, 13:32:43 »

I've reinstalled jComments 2.3 and followed the tutorial you linked.

Now is working SUPER WELL!

Thank you so much!  Wink Wink
Logged
stopyz
Newbie
*

Karma: 0
Offline Offline

Posts: 9


Email
« Reply #8 on: October 25, 2013, 18:09:27 »

Cool  Wink
Logged
edsontomaz
Newbie
*

Karma: 0
Offline Offline

Posts: 2


« Reply #9 on: March 14, 2014, 18:51:33 »

One doubt: if we make changes in the component files, won't we loose it in the next upgrade? Shouldn't it be done through template overrides?

Logged
Spatanjo
Newbie
*

Karma: 0
Offline Offline

Posts: 1


Email
« Reply #10 on: April 02, 2014, 17:17:29 »

Find it difficult to accept the knowledge that you have spoken about what we want to stay fit.
Logged

almamun
Newbie
*

Karma: 0
Offline Offline

Gender: Male
Posts: 9


mamundnj
WWW Email
« Reply #11 on: April 10, 2014, 00:20:47 »

Hi Smart,

Is the recaptcha plugin available?
Logged

JoomlaBangla.com- Joomla Bangla support site.
lgwapnitsky
Newbie
*

Karma: 0
Offline Offline

Posts: 1


« Reply #12 on: April 25, 2014, 23:10:38 »

Instructions for Joomla 3.x and JComments 3.x are not valid.  I'm not seeing the tpl folder, nor the specific files.  I've grepped the php files for the word 'captcha' and come up empty for the most part - maybe one result, but it's not what i'm looking for.

please advise.
Logged
shawnhy
Newbie
*

Karma: 0
Offline Offline

Posts: 1


Email
« Reply #13 on: November 04, 2014, 21:30:46 »

Hi stopyz,
That guide is really great! Thank you for the contribution.

I try Jcomments 3.0.5 no Joomla 3.3.6 not successful. Is it normal?

I really expect the coming of reCAPTCHA plugin!

Shawn
Logged
rettatate20
Newbie
*

Karma: 0
Offline Offline

Gender: Female
Posts: 1



WWW Email
« Reply #14 on: November 25, 2014, 18:17:56 »

Very nice and informative post. Thanks for sharing. Huh
Logged
Pages: [1] 2 3   Go Up
  Print  
JoomlaTune Support Forum    JComments component    Integration with third-party extensions    Topic: JComments 3.0.0 Recaptcha Integration Joomla 3.1.5
 
Jump to: