This is what's necessary in the case of SA-Chat. SA-Chat's index.php file will require the following edit:
Search for: define('SMF', 1);
// Experimental Optimizer
define('loadOpt', 1);
session_start();
session_cache_limiter('nocache');
// Lets go head and load the settings here.
require_once(str_replace('//','/',dirname(__FILE__).'/').'../Settings.php');
// Load SMF's compatibility file for unsupported functions.
if (@version_compare(PHP_VERSION, '5') == -1) {
require_once($sourcedir . '/Subs-Compat.php');
}
Replace with://
// SA-Chat - index.php - Modified to prevent cookies being set when they haven't been
// expressly permitted by the user. Based on Emanuele's EU Cookie Law modification.
//
define('SMF', 1);
// Experimental Optimizer
define('loadOpt', 1);
// Lets go head and load the settings here.
require_once(str_replace('//','/',dirname(__FILE__).'/').'../Settings.php');
// Load SMF's compatibility file for unsupported functions.
if (@version_compare(PHP_VERSION, '5') == -1) {
require_once($sourcedir . '/Subs-Compat.php');
}
//
// Load Emanuele's 'EU Cookie-checker Modification.
require_once($sourcedir . '/Subs-EclWarning.php');
// If the user hasn't accepted cookies, get out! We can not go ahead and load SA-Chat
// because set_session() sets cookies and so potentially does SA-Chat's javascript.
if (!ecl_authorized_cookies())
die();
// Okay, cookies can be set so continue.
session_start();
session_cache_limiter('nocache');
It should be noted that the above will prevent SA-Chat from loading and invoking session_start() which causes a cookie to be set. It is necessary to stop SA-Chat from loading because its Javascript also has the potential of setting cookies.
For the sake of completeness, here's the modification necessary to prevent Google Analytics from setting all its cookies:
In subs.php
Search for:
function ob_google_analytics($buffer)
{
global $modSettings, $boardurl;
Replace with:
function ob_google_analytics($buffer)
{
global $modSettings, $boardurl;
if (!ecl_authorized_cookies())
return;
As far as I am concerned, Emanuele's Mod coupled with the above change means that no cookies whatsoever are set until the visitor clicks on the "Accept" link. This means my sites now comply fully with the EU Directive and with UK law.
Thank you very much indeed Emanuele for providing this modification!
Mark