JReviews logo Docs
Menu
Version

cookie_consent

Allows disabling certain features until cookie consent is granted.

Filter
Privacy

You need to have a working knowledge of Hooks before you get started.

When the cookie_consent filter returns false:

  • Map features are disabled
  • IP geotargeting is disabled
  • Youtube videos loaded from youtube-nocookie.com domain

Parameters

Name Type Description
$consent parameter (boolean) default consent value is true

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
    // 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

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 Files

  • /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