XF 2.3 Redirect when clicking cookie banner

Alvin63

Well-known member
Licensed customer
So my site is doing something it shouldn't. If a guest goes to the site , when you click the cookie banner, a Redirect notice comes up and the cookie banner doesn't go away. If clicking the redirect link, it takes you to the main forum page. It's the same on the home page and also the forums page.

I just upgraded to 2.3.11 the other day so I'm not sure if it's only happened since then or not.
 
@Chris D this seems like a genuine bug, perhaps introduced in 2.3.11, maybe earlier? I am not sure.

Short version: the template still calls cookie-consent, but the JS handler seems gone.

In XF 2.3.11, public:misc_cookies still renders the Accept/Reject cookie buttons with data-xf-click="cookie-consent":
/src/addons/XF/_data/templates.xml:65610 and :65619.

But the 2.3.11 JS does not appear to register a cookie-consent click handler. The event system then falls through to normal link navigation, so /misc/cookies?update=1&accept=1... is loaded as a normal HTML page. XF\Pub\Controller\MiscController::actionCookies() applies consent and returns a redirect reply, which explains the visible “Redirecting” page.

In XF 2.2.19 this was handled by XF.CookieConsentClick in js/xf/core/structure.js:3352, registered at :3525 via XF.Event.register('click', 'cookie-consent', 'XF.CookieConsentClick'). That equivalent handler/registration seems absent in 2.3.11.

If this is wrong, then apologies in advance. I just thought it might help to investigate, as a lot of forums use the consent banners.
 
I've set it to simple cookie banner instead of advanced cookie banner and that works. But that's temporary as the simple cookie banner doesn't meet GDPR.
 
I've set it to simple cookie banner instead of advanced cookie banner and that works. But that's temporary as the simple cookie banner doesn't meet GDPR.

That's good information. Switching to simple mode works because it bypasses the advanced data-xf-click="cookie-consent" handler entirely and uses the standard .js-noticeDismiss notice-dismiss path. That supports this being specific to the advanced cookie consent JS path I reported above. Let's see what @Chris D says about it. p.s., I believe if you report the bug to XenForo directly at https://xenforo.com/customers/support they will get to it sooner. Might as well link this thread in the ticket so it's not doubling up on their work.
 
That's good information. Switching to simple mode works because it bypasses the advanced data-xf-click="cookie-consent" handler entirely and uses the standard .js-noticeDismiss notice-dismiss path. That supports this being specific to the advanced cookie consent JS path I reported above. Let's see what @Chris D says about it. p.s., I believe if you report the bug to XenForo directly at https://xenforo.com/customers/support they will get to it sooner. Might as well link this thread in the ticket so it's not doubling up on their work.
Thank you. I've opened a post in bug reports on here. So something to do with changes to javascript? Just wondering if anyone else is having it though?
 
Thank you. I've opened a post in bug reports on here. So something to do with changes to javascript? Just wondering if anyone else is having it though?

I don't use cookie consent banners (not required in my country). But I am saying, I believe your issue is supported in 2.3.11 code as a potentially introduced bug.
 
Resolved by disabling an addon. Thanks to @AndyB for solving this. misc_cookies template had been modified by Xon's standard library addon, so maybe a conflict since upgrading to 2.3.11. Have posted on Xon's standard library thread to report that.
 
Back
Top Bottom