1

I have a basic Contact form built in a site I manage for a client. But for some reason, the form fails to submit if I'm (or the user using the site) isn't logged into the site (CMS). But this site is a basic marketing site, so visitors to the site do not have Craft CMS user accounts. Any idea what could be happening here? The logs don't help.

  • Can you post what version of Craft and Sprout Forms you are working with and update to the latest, if that's an option. (EDIT: I see you did in a support ticket!) Can you share any more details about how how the form fails to submit? Perhaps try disabling Captchas to reduce variables. Are you using Form Template overrides? Can you try submitting with a test page using just the output of the displayForm() tag and see if the behavior is the same? – Ben Parizek Oct 29 '19 at 0:01
  • Real quick, here are my version: Craft Pro 3.3.0.1 and Sprout Forms 3.2.4 – carbonjoetunis Oct 29 '19 at 1:30
  • Can you upgrade to the latest to confirm the issue wasn't addressed in a recent update? As of this note: Craft 3.3.13 and Sprout Forms 3.5.1 – Ben Parizek Oct 30 '19 at 2:31
  • 1
    I actually updated everything last night and it all started working. And the code it was breaking on (exception thrown) seemed to be related to the craft\web\Controller code with regard to guest entries or something (noted in the Answer below). So all good now. – carbonjoetunis Oct 30 '19 at 12:04
1

This might not help but I've had a similar problem with a couple of my own modules and then with LInkVault that I went around in circles with. It suddenly stopped allowing non logged in users from downloading files. I contacted support who spotted the issue and fixed it in minutes. They gave this message:

Link Vault’s FrontEndController class has the allowAnonymous property set to true so that can’t be part of the problem

then a few minutes later:

Apparently, a recent Craft update added some logic in the craft\web\Controller::init() method that converts boolean allowAnonymous values to an integer which was part of the check that determines whether guests should be able to access a controller action. Link Vault’s front end controller had its own init() method but it wasn’t calling the parent’s init() method. So that is fixed now.

I leave this here in case it's any help either to this specific problem or anyone else with modules that run in to this issue.

| improve this answer | |
  • Hmmm, seeing this in the version of the SproutForms plug's EntryController /** @property null|\barrelstrength\sproutforms\elements\Entry $entryModel */ class EntriesController extends BaseController { ... protected $allowAnonymous = [ 'save-entry' ]; public $form; public function init() { $response = Craft::$app->getResponse(); $headers = $response->getHeaders(); $headers->set('Cache-Control', 'private'); } – carbonjoetunis Oct 29 '19 at 1:36
  • Yep, upgraded everything and all is well now. Thanks – carbonjoetunis Oct 30 '19 at 12:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.