• Resolved bjarkepetersen

    (@bjarkepetersen)


    i’ve used the code in your documentation and fitted it, but it has not worked for me.

    `
    function cmplz_my_filter_site_needs_cookiewarning( $cookiewarning_required
    ) {
    $url = is_ssl() ? “https” : “http” . “://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]”;

    //don’t show cookie banner on page where the URL contains the word “listing”
    if ( strpos($url, ‘listing’) !== FALSE )
    // don’t show on specific Post ID’s – uncomment below
    // if ($post->ID==241441 || $post->ID==241442 || $post->ID==241443)

    {
    $cookiewarning_required = false;

    //to disable the cookieblocker, uncomment the following
    define(‘CMPLZ_DO_NOT_BLOCK’, true);
    }

    return $cookiewarning_required;
    }
    add_filter( ‘cmplz_site_needs_cookiewarning’, ‘cmplz_my_filter_site_needs_cookiewarning’ );

    The page I need help with: [log in to see the link]

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Contributor jarnovos

    (@jarnovos)

    Hi @bjarkepetersen,

    You might not need the filter to disable the Cookie Banner on a specific page: you can edit your page with the Gutenberg or Classic Editor, and tick the checkbox next to “Disable Complianz on this page”. For the full explanation, please see: https://complianz.io/excluding-pages-from-the-cookie-banner/

    Just let me know if that approach works for you.
    Kind regards,
    Jarno

    Thread Starter bjarkepetersen

    (@bjarkepetersen)

    yes, im aware of that.

    actaully my issue is that have a listing site, and i’ve developed a iframe of the rating that is connected to that listing.

    but when i put that iframe into another website, the cookie banner appears in that embed.

    i wanted to remove the cookie banner on the specifik link where the embed happens, which was “/?star-average” but it seems to me that the code that i got from your documentation wont work?

    Plugin Author Rogier Lankhorst

    (@rogierlankhorst)

    @bjarkepetersen This works fine for me. I have made a small adjustment to prevent duplicate definition of the cmplz_do_not_block constant:

    function cmplz_my_filter_site_needs_cookiewarning( $cookiewarning_required ) {
    	$url = is_ssl() ? "https" : "http" . "://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
    
        //don’t show cookie banner on page where the URL contains the word “listing”
        if ( strpos($url, 'listing') !== FALSE )	{
    		$cookiewarning_required = false;
    		if (!defined('CMPLZ_DO_NOT_BLOCK') ) define('CMPLZ_DO_NOT_BLOCK', true);
    	}
    
        return $cookiewarning_required;
    }
    add_filter( 'cmplz_site_needs_cookiewarning', 'cmplz_my_filter_site_needs_cookiewarning' );
    Thread Starter bjarkepetersen

    (@bjarkepetersen)

    Plugin Contributor jarnovos

    (@jarnovos)

    Hi @bjarkepetersen,

    We are running our tests using the latest version of Complianz, which is version 6.1. Could you update to the latest version as well, to see if that works for you?

    Kind regards,
    Jarno

    Plugin Contributor Aert Hulsebos

    (@aahulsebos)

    Hi @bjarkepetersen,

    Could add below as an MU plugin? https://complianz.io/adding-filters-with-mu-plugins-quick-easy/

    <?php
    defined( 'ABSPATH' ) or die( "you do not have acces to this page!" );
    
    function cmplz_my_filter_site_needs_cookiewarning( $cookiewarning_required) {
    	$url = is_ssl() ? "https" : "http";
    	$url .= "://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
    
    	if ( strpos( $url, 'listing' ) !== false ) {
    		$cookiewarning_required = false;
    			define('CMPLZ_DO_NOT_BLOCK', true);
    	}
    	return $cookiewarning_required;
    }
    
    add_filter( 'cmplz_site_needs_cookiewarning', 'cmplz_my_filter_site_needs_cookiewarning' );
    Plugin Author Rogier Lankhorst

    (@rogierlankhorst)

    @bjarkepetersen Aert is correct, there is an error in the code I used, which only surfaces when used on https. So on my localhost it works.

    This one (same as the one Aert used) is correct:
    https://github.com/Really-Simple-Plugins/complianz-integrations/blob/master/exclude-cookie-blocker-and-banner.php

    The code in the article will be updated soon.

    Thanks for reporting.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Hiding on multiple places’ is closed to new replies.