• Resolved pubuse19

    (@pubuse19)


    Hi,

    Is there a way to disable the Complianz Cookie Banner for logged in users?

    I know I can disable it on specific pages, but that is not what I am looking for.

    Kind regards

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

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

    (@jarnovos)

    Hi @pubuse19,

    You could do this with a filter like in the example attached below:

    <?php
    defined( 'ABSPATH' ) or die( "you do not have acces to this page!" );
    
    function cmplz_my_filter_site_needs_cookiewarning( $cookiewarning_required) {
    
    	if ( is_user_logged_in() !== false ) {
    		$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' );

    It can be uploaded as a PHP file in the folder /wp-content/mu-plugins/, please refer to our article on installing MU Plugins for detailed instructions on doing this.

    Kind regards,
    Jarno

    Thread Starter pubuse19

    (@pubuse19)

    Sorry, it’s not working for me. It just shows the php code on my webpage and the cookie banner is still showing.

    I thought it might be as simple as adding a snipped.

    It’s a pity, because I like the Complianz Cookie Banner, but now I can’t use it.

    Thanks for answering Jarno.

    Thread Starter pubuse19

    (@pubuse19)

    I use this snippet for GDPR Cookie Consent, but I like the looks from Complianz Cookie Banner better..

    //do not copy this line

    add_filter(‘cli_show_cookie_bar_only_on_selected_pages’, ‘wt_cli_hide_bar_for_logged_in_users’, 10, 2);
    function wt_cli_hide_bar_for_logged_in_users($html) {
    if( is_user_logged_in()) {
    return ”;
    }

    return $html;
    }

    Plugin Contributor jarnovos

    (@jarnovos)

    Hi @pubuse19,

    Could you try copying and pasting the previously attached code to a new PHP file, and upload it to the folder /wp-content/mu-plugins/ on your website? That should be it.

    You can follow the steps in this guide: https://complianz.io/adding-filters-with-mu-plugins-quick-easy/

    Kind regards,
    Jarno

    Thread Starter pubuse19

    (@pubuse19)

    Yes! It works. Thank you Jarno.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Disable banner for loggin users’ is closed to new replies.