[Solved] reCaptcha not integrating into subscription form

I must be doing something dumb, as this seems basic:

New install of phpList 3.3.1. Created a subscription page.

Installed the common and recaptcha plugins. The phpinfo, config.php and php session actions appear and work.

Common plugin is 3.6.5+20170811, reCaptcha is 1.3.0+20170609 PHP is 5.6.30

Configured the site keys (public and secret). These keys work in another area of this site.
Left the method the default (http wrapper).

Edited the subscription page. Checked “Include reCaptcha in the subscribe page”, left color light, size normal.

Save changes.

Go to the subscription page. There is no trace of reCaptcha. Not the script in the HEAD nor the DIV in the body. Checked with view source & firebug.

I made other changes to the subscription page; they show up. So it’s not cached.

I tried putting the script and div tags in manually; I can get the “i’m not a robot” captcha to appear, but the solution isn’t acknowledged.

I tried the CURL method; no change.

Any clues?

Many thanks.

Update:

I read the plugin code, but no reason jumps out:

No HTML is returned if:
displaySubscriptionChoice finds recaptcha_include is empty (it is 1 in the database)
or
activate() found the keys aren’t entered (Confirmed in the database that both are present)

Otherwise, the HTML should be added. But it’s not.

So we must conclude that either ‘activate’ or 'displaySubscriptionChoice’
is not being called.

Why that might be is beyond me.

@tlhackque Can you add this at the start of the displaySubscriptionChoice() method to see what the values actually are:

    var_dump($pageData['recaptcha_include']);
    var_dump($this->keysEntered);

Duncan,

@duncanc: Thanks for the help. I tried your diagnostic.

I got no output from displaySubscriptionChoice.

So…I gathered some more information.

I added a var_dump($this) to activate(), and the keys are present, keysEntered is true,

Thus, the module is loading and is being activated.

I switched to writing a file (in case there were output/server/browser interactions, since activate() is called before <head> is generated.)

The file gets the same output from activate(), none from displaySubscriptionChoice.

So I don’t think displaySubscriptionChoice is being called.

Here is the code that I used at the end of activate:

    $this->keysEntered = $this->siteKey !== '' && $this->secretKey !== '';
     ob_start();
     echo "activate\n";
     var_dump($this);
     $txt = ob_get_contents();
     ob_end_clean();
     $file=fopen("/home/andreas/phplog/dump.txt", "w") or die( "fopen");
     fwrite($file,$txt);
     fclose($file);
    }

and at the beginning of displaySubscriptionChoice:

    ob_start();
    echo "display\n";
    var_dump($pageData['recaptcha_include']);
    var_dump($this->keysEntered);
    $txt = ob_get_contents();
    ob_end_clean();
    $file=fopen("/home/andreas/phplog/dump.txt", "a") or die( "fopen");
    fwrite($file,$txt);
    fclose($file);

    if (empty($pageData['recaptcha_include'])) {

Here is the dump from activate() - I deleted the keys.

[removed as it didn’t contribute to the solution]

@tlhackque This is a bit puzzling. Can you add a dump to the file lists/index.php at line 660

var_dump($GLOBALS['plugins']);

immediately before

foreach ($GLOBALS['plugins'] as $pluginname => $plugin) {

Thanks for the clue & effort. @duncanc. I was puzzled too. I tracked this down to a mod_security rule (which was a challenge because on this hosted system I don’t have access to the error log.)

Sigh. Sorry for the false alarm.

However, I now see that there’s no reCAPTCHA added to the Unsubscribe form… There probably should be.

And it’s worth considering adding one to the Login form. (and skipping/emitting a placeholder for the CAPTCHA for logged-in users).

Finally, many CAPTCHA plugins (for other applications) provide the ability to specify a whitelist for known IP addresses (IPv4 & IPV6). Connections from those addresses don’t present a CAPTCHA. This is convenient for site owners with a static (or rarely changing) IP address, and for those users on an internal (firewalled) network.

Thanks again.

Well, I have exactly the same problem with a fresh update to 3.3.3.
If I add the var_dump at line 677 immediately before the line foreach ($GLOBALS['plugins'] as $pluginname => $plugin) {, I get :
array(4) {
[“simpleattributeselect”]=>
object(simpleattributeselect)#4 (24) {
[“name”]=>
string(42) “Simple attribute select plugin for phpList”
[“coderoot”]=>
string(8) “plugins/”
[“version”]=>
string(3) “0.1”
[“authors”]=>
string(16) “Michiel Dethmers”
[“enabled”]=>
bool(true)
[“description”]=>
string(45) “Segment subscribers based on attribute values”
[“numcriterias”:“simpleattributeselect”:private]=>
string(1) “2”
[“settings”]=>
array(1) {
[“simpleattributeselect_numcriterias”]=>
array(7) {
[“value”]=>
int(2)
[“description”]=>
string(40) “Amount of criterias to use for selection”
[“type”]=>
string(7) “integer”
[“allowempty”]=>
int(0)
[“min”]=>
int(1)
[“max”]=>
int(10)
[“category”]=>
string(12) “segmentation”
}
}
[“documentationUrl”]=>
string(0) “”
[“system_root”]=>
string(41) “/home/userName/public_html/newsletter/admin”
[“configvars”]=>
array(0) {
}
[“DBstruct”]=>
array(0) {
}
[“commandlinePluginPages”]=>
array(0) {
}
[“publicPages”]=>
array(0) {
}
[“configArray”]=>
array(0) {
}
[“importTabTitle”]=>
string(42) “Simple attribute select plugin for phpList”
[“needI18N”]=>
int(0)
[“editorProvider”]=>
bool(false)
[“authProvider”]=>
bool(false)
[“priority”]=>
int(10)
[“tables”]=>
array(0) {
}
[“topMenuLinks”]=>
array(0) {
}
[“pageTitles”]=>
array(0) {
}
[“origin”]=>
string(75) “/home/userName/public_html/newsletter/admin/plugins/simpleattributeselect.php”
}
[“CaptchaPlugin”]=>
object(CaptchaPlugin)#5 (23) {
[“name”]=>
string(14) “Captcha Plugin”
[“enabled”]=>
bool(true)
[“description”]=>
string(46) “Creates a captcha field for subscription forms”
[“documentationUrl”]=>
string(44) “https://resources.phplist.com/plugin/captcha
[“authors”]=>
string(14) “Duncan Cameron”
[“settings”]=>
array(7) {
[“captcha_securimage_path”]=>
array(5) {
[“description”]=>
string(52) “Path to the securimage directory (from the web root)”
[“type”]=>
string(4) “text”
[“value”]=>
string(11) “/securimage”
[“allowempty”]=>
bool(false)
[“category”]=>
string(7) “Captcha”
}
[“captcha_bot_email”]=>
array(5) {
[“description”]=>
string(55) “Whether to validate the email address using bot bouncer”
[“type”]=>
string(7) “boolean”
[“value”]=>
string(1) “1”
[“allowempty”]=>
bool(true)
[“category”]=>
string(7) “Captcha”
}
[“captcha_captcha_prompt”]=>
array(5) {
[“value”]=>
string(42) “Please enter the text in the CAPTCHA image”
[“description”]=>
string(28) “Prompt for the CAPTCHA field”
[“type”]=>
string(4) “text”
[“allowempty”]=>
int(0)
[“category”]=>
string(7) “Captcha”
}
[“captcha_captcha_message”]=>
array(5) {
[“value”]=>
string(48) “The CAPTCHA value that you entered was incorrect”
[“description”]=>
string(57) “Message to be displayed when entered CAPTCHA is incorrect”
[“type”]=>
string(4) “text”
[“allowempty”]=>
int(0)
[“category”]=>
string(7) “Captcha”
}
[“captcha_bot_message”]=>
array(5) {
[“value”]=>
string(44) “You cannot subscribe with this email address”
[“description”]=>
string(54) “Message to be displayed when email address is rejected”
[“type”]=>
string(4) “text”
[“allowempty”]=>
int(0)
[“category”]=>
string(7) “Captcha”
}
[“captcha_eventlog”]=>
array(5) {
[“description”]=>
string(77) “Whether to log event for each rejected captcha and each rejected subscription”
[“type”]=>
string(7) “boolean”
[“value”]=>
string(1) “1”
[“allowempty”]=>
bool(true)
[“category”]=>
string(7) “Captcha”
}
[“captcha_copyadmin”]=>
array(5) {
[“description”]=>
string(94) “Whether to send an email to the admin for each rejected captcha and each rejected subscription”
[“type”]=>
string(7) “boolean”
[“value”]=>
string(1) “0”
[“allowempty”]=>
bool(true)
[“category”]=>
string(7) “Captcha”
}
}
[“version”]=>
string(14) “2.1.1+20180102”
[“system_root”]=>
string(41) “/home/userName/public_html/newsletter/admin”
[“coderoot”]=>
string(64) “/home/userName/public_html/newsletter/admin/plugins/CaptchaPlugin/”
[“configvars”]=>
array(0) {
}
[“DBstruct”]=>
array(0) {
}
[“commandlinePluginPages”]=>
array(0) {
}
[“publicPages”]=>
array(0) {
}
[“configArray”]=>
array(0) {
}
[“importTabTitle”]=>
string(14) “Captcha Plugin”
[“needI18N”]=>
int(0)
[“editorProvider”]=>
bool(false)
[“authProvider”]=>
bool(false)
[“priority”]=>
int(10)
[“tables”]=>
array(0) {
}
[“topMenuLinks”]=>
array(0) {
}
[“pageTitles”]=>
array(0) {
}
[“origin”]=>
string(67) “/home/userName/public_html/newsletter/admin/plugins/CaptchaPlugin.php”
}
[“CommonPlugin”]=>
object(CommonPlugin)#8 (22) {
[“name”]=>
string(13) “Common Plugin”
[“enabled”]=>
bool(true)
[“authors”]=>
string(14) “Duncan Cameron”
[“description”]=>
string(56) “Provides support classes required by some other plugins.”
[“documentationUrl”]=>
string(43) “https://resources.phplist.com/plugin/common
[“topMenuLinks”]=>
array(3) {
[“phpinfo”]=>
array(1) {
[“category”]=>
string(6) “config”
}
[“config_file”]=>
array(1) {
[“category”]=>
string(6) “config”
}
[“session”]=>
array(1) {
[“category”]=>
string(6) “config”
}
}
[“publicPages”]=>
array(1) {
[0]=>
string(5) “image”
}
[“version”]=>
string(15) “3.7.15+20180402”
[“system_root”]=>
string(41) “/home/userName/public_html/newsletter/admin”
[“coderoot”]=>
string(63) “/home/userName/public_html/newsletter/admin/plugins/CommonPlugin/”
[“configvars”]=>
array(0) {
}
[“DBstruct”]=>
array(0) {
}
[“commandlinePluginPages”]=>
array(0) {
}
[“configArray”]=>
array(0) {
}
[“importTabTitle”]=>
string(13) “Common Plugin”
[“needI18N”]=>
int(0)
[“editorProvider”]=>
bool(false)
[“authProvider”]=>
bool(false)
[“priority”]=>
int(10)
[“tables”]=>
array(0) {
}
[“pageTitles”]=>
array(3) {
[“phpinfo”]=>
string(7) “phpinfo”
[“config_file”]=>
string(10) “config.php”
[“session”]=>
string(11) “php session”
}
[“origin”]=>
string(66) “/home/userName/public_html/newsletter/admin/plugins/CommonPlugin.php”
}
[“fckphplist”]=>
object(fckphplist)#9 (23) {
[“name”]=>
string(28) “FCKeditor plugin for phpList”
[“coderoot”]=>
string(61) “/home/userName/public_html/newsletter/admin/plugins/fckphplist/”
[“editorProvider”]=>
bool(true)
[“version”]=>
string(3) “0.2”
[“authors”]=>
string(16) “Michiel Dethmers”
[“enabled”]=>
bool(true)
[“description”]=>
string(39) “The original WYSIWYG editor for phpList”
[“settings”]=>
array(4) {
[“fckeditor_width”]=>
array(7) {
[“value”]=>
int(600)
[“description”]=>
string(29) “Width in px of FCKeditor Area”
[“type”]=>
string(7) “integer”
[“allowempty”]=>
int(0)
[“min”]=>
int(100)
[“max”]=>
int(800)
[“category”]=>
string(11) “composition”
}
[“fckeditor_height”]=>
array(7) {
[“value”]=>
int(600)
[“description”]=>
string(30) “Height in px of FCKeditor Area”
[“type”]=>
string(7) “integer”
[“allowempty”]=>
int(0)
[“min”]=>
int(100)
[“max”]=>
int(800)
[“category”]=>
string(11) “composition”
}
[“fckeditortoolbar_row2”]=>
array(5) {
[“value”]=>
string(0) “”
[“description”]=>
string(44) “Second row of toolbar elements in the editor”
[“type”]=>
string(4) “text”
[“allowempty”]=>
int(1)
[“category”]=>
string(11) “composition”
}
[“fckeditor_path”]=>
array(5) {
[“value”]=>
string(29) “plugins/fckphplist/fckeditor/”
[“description”]=>
string(28) “Public path to the FCKeditor”
[“type”]=>
string(4) “text”
[“allowempty”]=>
int(0)
[“category”]=>
string(11) “composition”
}
}
[“documentationUrl”]=>
string(0) “”
[“system_root”]=>
string(41) “/home/userName/public_html/newsletter/admin”
[“configvars”]=>
array(0) {
}
[“DBstruct”]=>
array(0) {
}
[“commandlinePluginPages”]=>
array(0) {
}
[“publicPages”]=>
array(0) {
}
[“configArray”]=>
array(0) {
}
[“importTabTitle”]=>
string(28) “FCKeditor plugin for phpList”
[“needI18N”]=>
int(0)
[“authProvider”]=>
bool(false)
[“priority”]=>
int(10)
[“tables”]=>
array(0) {
}
[“topMenuLinks”]=>
array(0) {
}
[“pageTitles”]=>
array(0) {
}
[“origin”]=>
string(64) “/home/userName/public_html/newsletter/admin/plugins/fckphplist.php”
}
}

S’abonner à nos listes What can I try ?