• Resolved marsvieyra

    (@marsvieyra)


    Hello,

    How can I disable the bar for ever when a user hits Accept, and at the same time keep on showing it every X days if declined?

    I saw this code about cookies, but it does not distinguish between accept and not:

    add_action('wp_footer','cli_set_expire',20);
    function cli_set_expire()
    { 
    	if(class_exists('Cookie_Law_Info_Public')) //first time visit and class exists
    	{
    	?>
    	<script type="text/javascript">
    
    		CLI_ACCEPT_COOKIE_EXPIRE = 30;
    		
    	</script>
    	<?php
    	}
    }

    Thanks so much!

    Thanks!

Viewing 1 replies (of 1 total)
  • Plugin Author WebToffee

    (@webtoffee)

    Hi @marsvieyra,

    Please try using below code:

    add_action('wp_footer','cli_set_expire',20);
    function cli_set_expire() { 
    	if(class_exists('Cookie_Law_Info_Public')) //first time visit and class exists
    	{
    	?>
    	<script type="text/javascript">
    		CLI_ACCEPT_COOKIE_EXPIRE = 365;//accept cookie expire after 365 days
    		var CLI_REJECT_COOKIE_EXPIRE_DAYS = 5;//cookie bar reappear after 5 days upon reject
    		jQuery(function() {
    			jQuery('.cli_action_button').click(function(e){
    				e.preventDefault();
    				if(jQuery(this).attr('data-cli_action') == 'reject') {
    					setTimeout(function() {
    						CLI_Cookie.set(CLI_ACCEPT_COOKIE_NAME,'no',CLI_REJECT_COOKIE_EXPIRE_DAYS);
    					}, 300);	
    				}
    			});
    		});	
    	</script>
    	<?php
    	}
    }
Viewing 1 replies (of 1 total)
  • The topic ‘Don’t show again on Accept, show always if not’ is closed to new replies.