richardhj/contao-ajax_reload_element

Newsletter Confirmation-Mail

manjarco opened this issue · 4 comments

When using the ajax-reload with the standard newsletter-subscription-module the link in the confirmation-e-mail gets altered to something like this:

http://example.com/SimpleAjaxFrontend.php?action=reload-element&element=mod%3A%3A6&auto_item=&page=2&REQUEST_TOKEN=73e071a55effead3446a534fae72c60e&token=a6896a0636d0c607832ad83d0479508f

… which is unusable and produces an error.

As you can see in the ModuleSubscribe.php this is how the link is generated:

$arrData['link'] = \Idna::decode(\Environment::get('base')) . \Environment::get('request') . ((\Config::get('disableAlias') || strpos(\Environment::get('request'), '?') !== false) ? '&' : '?') . 'token=' . $strToken;

It is true, that Environment::get('request') outputs SimpleAjax.php instead of the "right" uri, because the SimpleAjax.php handles the content element.
I see two approaches: Overriding the class ModuleSubscribe or manipulating the Environment variables.
I am not ok with any of them because approach 1 is disproportionate and approach 2 most likely will influence other components.
Not using the ajax reload for the NewsletterSubscribe and RegistrationForm are the best solution as far as I can see.

Well, ok then. Thanks anyway!

I decided to set the request environment variable in e850a0d
Stay tuned, maybe it will be integrated in of the next releases

@manjarco version 2.0 does it better