Developer
Supported
Snaptcha
ExpressionEngine 2, ExpressionEngine 3, ExpressionEngine 4, ExpressionEngine 5, ExpressionEngine 6
Back to this add-on's main page
View Other Add-ons From PutYourLightsOn
Disable Snaptcha on forms for logged in users
Support (Resolved)
wardour
|
Posted: 28 February 2022 09:50 AM |
|
|
|
We are using freeform lite and Snaptcha.
Works great for the contact form on the front end of the website.
However for the password protected forms we have. There are some issues with submissions that is causing my client some concern.
It’s not clear why these forms are not always submitting, when every submission should be sent.
Really I’d love to disable the plugin for these password protected forms only. How can this be done?
Would appreciate any solutions.
Thanks in advance.
|
|
|
|
wardour
|
Posted: 01 March 2022 05:49 AM |
# 2
|
|
|
I believe so. We are using:
https://docs.solspace.com/expressionengine/freeform/v2/#key-features
Freeform Lite V2
Does the ‘Lite’ make a difference?
|
|
|
PutYourLightsOn
|
Posted: 01 March 2022 05:57 AM |
# 3
|
|
Developer
|
No, the “Lite” version shouldn’t make a difference. How are you password protecting the forms? I don’t see that as a feature in the Freeform v2 docs.
|
|
|
wardour
|
Posted: 02 March 2022 04:09 AM |
# 4
|
|
|
A user can only access the forms when they are registered and log in to a private area of the site.
|
|
|
PutYourLightsOn
|
Posted: 02 March 2022 05:12 AM |
# 5
|
|
Developer
|
Ah I see. There’s unfortunately no way to disable form validation in Snaptcha on a per form basis. What you could do is manually prevent validation for logged-in users, by adding the condition below to `ext.snaptcha.php`.
public function snaptcha_validate($security_level='') { // Don't validate if user is logged-in if (ee()->session->userdata('logged_in')) { return TRUE; }
|
|
|
wardour
|
Posted: 02 March 2022 05:34 PM |
# 6
|
|
|
Thanks that set me off in the right direction.
Initially I tried your code in ee6. No joy but made sense what you were suggesting.
There is not a ‘logged_in’ variable. But a quick search of the source code turned up a check against the member_id variable.
Final working code:
// Don't validate if user is logged-in if (ee()->session->userdata['member_id'] != 0) { return TRUE; }
|
|
|
PutYourLightsOn
|
Posted: 02 March 2022 07:23 PM |
# 7
|
|
Developer
|
Ah yes, I didn’t test in EE6, glad to hear you got it working!
|
|
|