Publisher does not support the Fluid field type. Please do not contact asking when support will be available.

If you purchased an add-on from expressionengine.com, be sure to visit boldminded.com/claim to add the license to your account here on boldminded.com.

Ticket: ee harbour FORMS (DevDemon Forms) snaptcha not active

Status Resolved
Add-on / Version Snaptcha 3.2.3
Severity
EE Version 7.3.15

Julius Lipp

Jan 26, 2024

I installed snaptcha and activated it in the settings. On the page where a form (ee harbour FORMS) is placed, when looking at the sources in devmode, I can’t find a field with the ID “snap”. In previous versions the support for “devdemon Forms” had to be set in one of the snaptcha files with “yes”, I think this is not more the case in the newer versions and it should work out of the box?

#1

BoldMinded (Brian)

Hi, Julius. When I acquired Snaptcha there were no real functional updates required. If it doesn’t work out of the box, then you’ll need to follow the docs and add the necessary field/tag to the form.

#2

Julius Lipp

Comment has been marked private.

#3

Julius Lipp

Comment has been marked private.

#4

BoldMinded (Brian)

I don’t know what or if anything has changed with the Forms module, e.g whatever “snaptcha support” you’re talking about. If that is something that no longer works or was removed from Forms then I can’t help with that. My suggestion is to use the form tag pair or create a support ticket with EE Harbor. I don’t see anything in the Snaptcha codebase, or it’s Git history, to suggest it has ever done anything special to handle the Forms module automatically.

#5

Julius Lipp

Comment has been marked private.

#6

BoldMinded (Brian)

Regarding the docs mentioning DevDemon forms, yes it does mention that, but it’s not implying that Snaptcha support also includes DevDemon Forms support. The Forms module is injecting code itself in an attempt to work with Snaptcha, which it could be doing incorrectly, I have no idea.

The error message in the screenshot also doesn’t reveal what the actual error is… it’s an empty bullet point with no error message.

Have you tried, as a debugging step, creating a form using the tag pair, and adding the exp:snaptcha:field tag inside the form manually to see if it works that way?

#7

Julius Lipp

There is no example in the ee harbor docs online how to do that with a tag pair. ’ What I could read out of the actual FORMS docs is, that the following should work but it does not. It just renders nothing…

{exp:forms:form form_name="testform"}
  {form:fields}
     {field:label} : {field:value}
  {/form:fields}
  {exp:snaptcha:field}
{/exp:forms:form}

When doing it with the one tag version ({exp:forms:form form_name=”testform”}) and setting the snaptcha support to “yes” in the addon.setup.php file I get the following error:

Warning
Trying to access array offset on value of type bool
user/addons/snaptcha/ext.snaptcha.php, line 53

Severity: E_WARNING
Warning
Trying to access array offset on value of type bool
user/addons/snaptcha/ext.snaptcha.php, line 55

Severity: E_WARNING
#8

BoldMinded (Brian)

What does your Snaptcha settings look like? Can you please share a screenshot? What version of PHP are you using?

#9

BoldMinded (Brian)

The reason I ask for a screenshot of the Snaptcha settings page is that error message implies to me that the settings were never saved.

#10

Julius Lipp

Will Share the screenshot im a second PHP Version 8.1.24

Thanks for helping!

#11

Julius Lipp

Comment has been marked private.

#12

BoldMinded (Brian)

That’s fine, the attachments are only visible to you and I.

So even with those settings you’re still getting that error on line 53?

Can you share a copy of the Forms module? Pasting a link in a private comment to a zip download would be fine. I don’t have a copy of it so I can’t debug it.

#13

Julius Lipp

Comment has been marked private.

#14

BoldMinded (Brian)

Where do you see the settings in Forms for Snaptcha? I don’t see anything in the admin or in the docs.

#15

Julius Lipp

In the addon-setup.php

#16

BoldMinded (Brian)

I see the issue. Forms is accessing the snaptcha_field function directly, and I changed how the settings are loaded in the latest version. Instead of sending a whole new file, update the beginning of the snaptcha_field() function on line 55 or so of ext.snapchat.php to be this:

public function snaptcha_field($security_level = '')
    {
        if (empty($this->settings)) {
            $this->_get_settings();
        }

   .... rest of the code here, just add the conditional...
#17

Julius Lipp

Comment has been marked private.

#18

BoldMinded (Brian)

Have you tried Snaptcha with a native ExpressionEngine form and taken Forms out of the equation? The error message isn’t displaying anything helpful, it’s just saying there is an error. Since I haven’t received any similar reports about Snaptcha in a long time it seems unlikely there is a broad bug/issue with Snaptcha. Until a helpful error message is revealed, I have to assume something is going on with the Forms module, not Snaptcha.

Try making other EE forms… login, logout, email submission etc… with Snaptcha and see what happens.

#19

Julius Lipp

Comment has been marked private.

#20

BoldMinded (Brian)

I’m going to set this as resolved as the change I suggested above was confirmed to work with Forms by the EE Harbor team. I’ve been in contact with them, and if anything else comes up to indicate that Snaptcha is the issue we can re-open this ticket and proceed.

#21

Julius Lipp

Sorry Brian, want to let you know, that the snaptcha hidden field is not injected in a native login form for example. Would this be an ee or a snaptcha thing then?

#22

BoldMinded (Brian)

You might have to explicitly add the snaptcha field to the form.

#23

Julius Lipp

Ok, again trouble also with the native form.

As you mentioned I created a native login form with the manual addition of then snaptcha field like this:

{exp:member:login_form}

        <label>Username</label>

        <input type="text" name="username" value="" maxlength="32" size="25" />
        <label>Password</label>

        <input type="password" name="password" value="" maxlength="32" size="25" />

        <input type="submit" name="submit" value="Submit" />
        {exp:snaptcha:field}

{/exp:member:login_form}

The snaptcha input field is injected! I am doing the test (deleting the input field via dev tools) like mentioned in the docs (under “Testing Snaptcha”) here: https://docs.boldminded.com/snaptcha/docs/configuration . The error message is not shown! I don’t know if it works or not…

#24

BoldMinded (Brian)

Sorry, I shouldn’t have mentioned the login form b/c it doesn’t work with the login form. The supported forms are listed in the docs: https://docs.boldminded.com/snaptcha/docs/configuration#using-snaptcha

There are some newer hooks in EE’s login and registration forms that might have come along after Snaptcha was initially released, and the previous developer might not have kept it up-to-date. I’ll take a look at adding those forms to the supported list, but it could take some time (days or weeks).

#25

BoldMinded (Brian)

Comment has been marked private.

#26

Julius Lipp

Comment has been marked private.

#27

BoldMinded (Brian)

What version of php are you using?

You might need to share a copy of Forms so I can test locally. Logging into someone else’s site is the absolute last thing I do and only if 100% necessary.

#28

BoldMinded (Brian)

The fact that the error page shows a generic message and nothing in the bullet point is concerning. It should show an error in the bulleted list. Please share a screenshot of your Snaptcha settings page.

#29

Julius Lipp

Comment has been marked private.

#30

Julius Lipp

Comment has been marked private.

#31

BoldMinded (Brian)

I can’t see the screenshot, I see the zip file though. Can you add a link to the screenshot in another comment.

#32

Julius Lipp

By Img1, I meant the FIRST image here in the ticket. I did overwrite the first image…

#33

BoldMinded (Brian)

Comment has been marked private.

#34

Julius Lipp

Finally! I think, that did it. My testform is now working and testable like mentioned in the snaptcha docs. What was the problem?

Thanks a lot Brian.

#35

BoldMinded (Brian)

Since Forms interacts with Snaptcha directly it wasn’t loading the settings correctly after I recently changed how the settings were saved.

Glad to hear that fixed it!

Login to reply