jDownloadsownloads.com


Author Topic: Enable ReCaptcha v2 in Joomla 2.5  (Read 223 times)

0 Members and 1 Guest are viewing this topic.

Offline jbdown

  • Newbie
  • *
  • Posts: 14
Enable ReCaptcha v2 in Joomla 2.5
« on: 22.01.2019 12:03:53 »
Hello,
I still use Joomla 2.5 and so far I could use the recaptcha from Google for downloading with jdownlaods as security.
Unfortunately, Joomla 2.5 only supports the V1 version, which has not been working since March 2018.
I have found a patch that will support the use of Recaptcha V2 for Joomla 2.5.
I did the patch after this tutorial
https://www.tabulizer.com/index.php/support-menu/tabulizer-tips/161-how-to-enable-recaptcha-v2-in-joomla-2-5 ,
and it seems to work on the test page (http://www.ktlspedition.de/test-recaptcha.php).
Unfortunately, the ReCaptcha is not displayed on the download page of jdownloads.
To be able to use 3rd party extension the following additions have to be made according to the description:

More specifically, the new PHP code should look like this:

<? Php
JPluginHelper :: import plugin ('captcha');
$ dispatcher = JDispatcher :: getInstance ();
$ Dispatcher> trigger ('dynamic_recaptcha_1' 'onInit');
$ reCaptchaName = 'plg_captcha_recaptcha';
$ output = $ dispatcher-> trigger ('onDisplay', array ($ reCaptchaName, 'dynamic_recaptcha_1', ''));
$ recaptcha_div = $ output
  • ;

?>

Paste this snippet where you want the reCAPTCHA widget to appear:

<? echo $ recaptcha_div; ?>

Old PHP code (must be replaced with the new code):

<? Php
JPluginHelper :: import plugin ('captcha');
$ dispatcher = JDispatcher :: getInstance ();
$ Dispatcher> trigger ('dynamic_recaptcha_1' 'onInit');
?>

Paste this snippet where you want the reCAPTCHA widget to appear:

<div id = "dynamic_recaptcha_1"> </ div>

Where can I insert the php snippet for jdownloads to run the ReCaptcha?
Thanks for your help.

Offline Arno

  • Administrator
  • ***
  • Posts: 12.384
    • jDownloads.com
Re: Enable ReCaptcha v2 in Joomla 2.5
« Reply #1 on: 22.01.2019 12:40:40 »
Hallo,
die Plugin Daten werden generiert in dieser Datei:
/com_jdownloads/site/views/summary/tmpl/default.php

Bitte bedenke aber folgendes:
- wir geben keinen Support mehr auf diese sehr alte Version
- du solltest dir dringend die Zeit nehmen um auf eine aktuelle Joomla- und jD Version zu wechseln. Die Probleme werden sonst immer weiter zunehmen.
Best Regards / Gruß
Arno
Please make a Donation for jDownloads and/or write a review on the Joomla! Extensions directory!

Offline jbdown

  • Newbie
  • *
  • Posts: 14
Re: Enable ReCaptcha v2 in Joomla 2.5
« Reply #2 on: 22.01.2019 19:25:50 »
Hallo, danke für die Hilfe.

Ich habe wie beschrieben den Code ausgetauscht.
Aber es funktioniert noch nicht, das Captcha wird immer noch nicht angezeigt (siehe Bild).
Hier die Schritte:

// captcha check
if ($this->user_rules->view_captcha){
// get captcha plugin

// alte PHP-Version
// JPluginHelper::importPlugin('captcha');
// $dispatcher = JDispatcher::getInstance();
// $dummy = $jinput->getString('recaptcha_response_field');

// neue PHP-Version 2019-01
JPluginHelper::importPlugin('captcha');
$dispatcher = JDispatcher::getInstance();
$dispatcher->trigger('onInit','dynamic_recaptcha_1');
$reCaptchaName = 'plg_captcha_recaptcha';
$output = $dispatcher->trigger('onDisplay', array($reCaptchaName, 'dynamic_recaptcha_1', ''));
$recaptcha_div = $output[0];


// altes snipet für captcha
//$captcha .= '<div id="dynamic_recaptcha_1">&#160;</div>';

// neues snipet für captcha
$captcha .= '<? echo $recaptcha_div; ?>';

Wo liegt hier der Fehler?
Danke