Allows disabling certain features until cookie consent is granted.
When the cookie_consent filter returns false:
- Map features are disabled
- IP geotargeting is disabled
- Youtube videos loaded from youtube-nocookie.com domain
Parameters
$consent
(boolean) default consent value is true
You need to have a working knowledge of Hooks before you get started.
Boilerplate Code
Use the boilerplate code to start using the filter, and add your own logic to modify the first argument and return it.
Clickfwd\Hook\Filter::add('cookie_consent', function($consent)
{
// Uncomment line below to view available data passed into hook
// For JReviews 3.x and earlier use dd instead of fwd_dd
// fwd_dd($consent);
return $consent;
});
Development & Support
Customizations are not included with support. We provide this information to make it easier for developers to extend the functionality. From time to time we may have some availability for custom work. Get in touch to see if there's an opportunity to work together.
Examples
Disable Features when Consent Not Granted
This is a generic example that checks for the presense of a cookie named consent_cookie
and assumes consent was not granted if the cookie doesn't exist.
Clickfwd\Hook\Filter::add('cookie_consent', function($consent)
{
$cookieName = 'consent_cookie';
if (! isset($_COOKIE[$cookieName]) )
{
return false;
}
return $consent;
}, 10);
Disable Features using iReview
When using our iReview Joomla template or WordPress theme, the consent cookie is named cookieconsent_status
.
Clickfwd\Hook\Filter::add('cookie_consent', function($consent)
{
$cookieName = 'cookieconsent_status';
if (!isset($_COOKIE[$cookieName]) || (isset($_COOKIE[$cookieName]) && $_COOKIE[$cookieName] !== 'dismiss') )
{
return false;
}
return $consent;
}, 10);
Source
-
/services/core_service_provider.php
-
/services/storage/youtube_storage.php
-
/geomaps/controllers/components/geomaps_geotargeting.php
-
/geomaps/controllers/modules/module_geomaps_controller.php
-
/geomaps/plugins/geomaps.php
-
/geomaps/plugins/geomaps_assets.php
-
/maps/controllers/modules/module_maps_controller.php
-
/maps/plugins/maps_load_assets.php
-
/maps/services/geolocation/geolocation.php