mailchimp icon indicating copy to clipboard operation
mailchimp copied to clipboard

Remove index from non cacheable Form action

Open houmark opened this issue 8 years ago • 3 comments

Hey there,

First sorry for what could looked like a messy commit history. Didn't get this one started off in a branch, but the change is a one liner so I hope it's cool.

I'm not 100% sure if there's some downside with this but after trying various things, the was the only thing that worked.

Situation:

We run a signup form on all pages on the site creating the form using TS so we can show it in the footer and as a popover in some page views:

lib.footerMailChimp = USER
lib.footerMailChimp {
  userFunc = TYPO3\CMS\Extbase\Core\Bootstrap->run
  pluginName = Registration
  extensionName = Mailchimp
  vendorName = Sup7even
  controller = Form
  settings =< plugin.tx_mailchimp.settings
  view =< plugin.tx_mailchimp.view
  view.templateRootPaths.1 = path/to/our/template/mailchimp/Footer/Templates/
  view.layoutRootPaths.1 = path/to/our/template/mailchimp/Footer/Layouts/
}

After moving to a new platform that includes Varnish caching, we noticed that all pages were missing the cache and so a USER_INT must be in play. Revising everything it turns out that the form is being created as USER_INT for some reason I don't understand.

Seems like there's no reason for that and so this PR is to remove it from the configurePlugin, as it will then render as a USER object.

If there's another way to force it as a USER without changing this, please let me know but I did some tests and it looks like the form works just fine (both with and without AJAX enabled) running as USER.

houmark avatar Oct 08 '17 09:10 houmark

It must be not cached as it also shows the errors if not filled correctly. If you are using it with ajax, I would propose to create a custom action which does the form

georgringer avatar Oct 09 '17 06:10 georgringer

mmm, okay, can you point in the direction in making a custom action? I was considering that and since I use it with AJAX all places it does show the error message correctly. Would it not be possible to switch to no cached if AJAX is not enabled?

houmark avatar Oct 09 '17 06:10 houmark

@houmark you could make that an extension configuration setting. And then define the plugin actions based on that setting.

Tuurlijk avatar Nov 20 '20 08:11 Tuurlijk