Disable Concrete5 Cookies
Permalink 4 users found helpful
A client of mine needs to ensure they're in compliance with the cookie laws in several European countries. Since this site's entirely informational, sessions really aren't being utilized, they want cookies turned off completely.
My solution works by testing to see if a cookie is already set, before starting the session. If there is no session started, I do not create one. It's only if the user goes to the login page, do I start a session, and only on the login page do I need to inform the user that we're utilizing cookies.
Here's my solution (which I'm still testing), but it does require that I change some core code, and I'm trying to avoid that.
concrete/startup/session.php
/controllers/login.php
I see there are several conversations here already, but no solutions to actually not use cookies:
http://www.concrete5.org/community/forums/customizing_c5/eu-cookie-...
http://www.concrete5.org/community/forums/chat/european-directive-t...
My solution works by testing to see if a cookie is already set, before starting the session. If there is no session started, I do not create one. It's only if the user goes to the login page, do I start a session, and only on the login page do I need to inform the user that we're utilizing cookies.
Here's my solution (which I'm still testing), but it does require that I change some core code, and I'm trying to avoid that.
concrete/startup/session.php
// Added a test for the cookie, we only start a session IF a cookie is already sent. if($_COOKIE[SESSION]) { session_name(SESSION); session_start(); }
/controllers/login.php
<?php defined('C5_EXECUTE') or die("Access Denied."); //Extend the core controller, and create a session here. //On the login page, I have my disclaimer that we utilize cookies. class LoginController extends Concrete5_Controller_Login { function on_start() { if(!$_COOKIE[SESSION]) { session_name(SESSION); session_start(); } parent::on_start(); } }
I see there are several conversations here already, but no solutions to actually not use cookies:
http://www.concrete5.org/community/forums/customizing_c5/eu-cookie-...
http://www.concrete5.org/community/forums/chat/european-directive-t...
This was working for me in 5.5, but after upgrading to 5.6 it seems to have stopped working.
Hi Has anyone managed to make this work with 5.7?
I know this is a long shot, but just wondering if anyone ended up figuring this out for concrete 5.6+?
This code should still work in 5.6. The files are slightly different but the changes you make to them are the same. It works for me.
Is there any chance that you've installed updates? If so, you will need to change the files that are found in /updates folder instead. Since concrete5 will be using the files located in the updates folder after an update is installed.
Is there any chance that you've installed updates? If so, you will need to change the files that are found in /updates folder instead. Since concrete5 will be using the files located in the updates folder after an update is installed.