WordPress.org

Ready to get started?Download WordPress

Forums

EU Cookie Law
Not working (8 posts)

  1. neatpete
    Member
    Posted 2 years ago #

    I have installed this, set it to 36 months but every time I reopen the Browser (chrome) the message reappears even when I have accepted the cookies previously?

    http://wordpress.org/extend/plugins/eu-cookie-law/

  2. zaptronic
    Member
    Posted 2 years ago #

    Same problem here. Is there a fix?

  3. Lumb
    Member
    Posted 2 years ago #

    Same here - it doesn't seem to matter what value you put in the time option box, or which browser you use - the message keeps on reappearing. Does it really need a time option set anyway - if a user clicks accept then the message should disappear unless they clear their cookie cache?

  4. neatpete
    Member
    Posted 2 years ago #

    The time is set for when you want the cookie to expire.
    I now use EU Cookie Law Complience Message plugin (by Azulia Designs) not had any problems with this one

  5. Lumb
    Member
    Posted 2 years ago #

    yes, I know that, but none of the other cookie law plugins I've looked at give the option to set a time limit. Their messages just disappear until the user clears their cookie cache... I only mentioned it in case it was this particular option that was preventing the otherwise excellent plugin from working properly. Thanks for the plugin info - will check it out.

  6. Wil
    Member
    Posted 1 year ago #

    Same issue here. Is the plugin author there?

  7. Wil
    Member
    Posted 1 year ago #

    I had a look at the code and there were two issues.
    1. The time was being set incorrectly in seconds rather than milliseconds
    2. The cookie was never being set with an expiry date and was missing the path statement.

    Here's the fixed class-frontend.php file:

    <?php
    
    function peadig_eucookie_scripts() {
    	wp_register_style	('basecss', plugins_url('peadig-eucookie.css', __FILE__), false);
    	wp_enqueue_style	('basecss');
    	wp_deregister_script('jquery');
    	wp_register_script	('jquery', 'http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js', false, '1.7.2');
    	wp_enqueue_script	('jquery');
    }
    add_action('wp_head', 'peadig_eucookie_scripts');
    
    function peadig_eucookie_bar(){
    	$options = get_option('peadig_eucookie');
    	if ($options['enabled'] == '1') {
    
    		if(!$_COOKIE['peadigCookie']){
    			//for Cookie
    			switch($options['length']){
    				case "hours":
    					$multi = 3600 * 1000;
    					break;
    				case "days":
    					$multi = 3600 * 24 * 1000;
    					break;
    				case "weeks":
    					$multi = 3600 * 24 * 7 * 1000;
    					break;
    				case "months":
    					$multi = 3600 * 24 * 30 * 1000;
    					break;
    			}//switch
    
    			$expireTimer = $multi * $options['lengthnum'];
    			//echo "<script type=\"text/javascript\">var tdate=new Date();tdate.setTime(tdate.getTime()+".$expireTimer.");var expires = tdate.toGMTString();alert('Cookie Expires: '+expires);</script>";
    	?>
    			<div class="pea_cook_wrapper pea_cook_<?php if ($options['position']!="") {echo $options['position'];} else {echo "bottomright";} ?>">
    				<p><?php echo $options['barmessage']; ?> <a href="#" id="fom"><?php echo $options['barlink']; ?></a> <button id="pea_cook_btn" class="pea_cook_btn" href="#"><?php echo $options['barbutton']; ?></button></p>
    			</div>
    			<div class="pea_cook_more_info_popover">
    				<div class="pea_cook_more_info_popover_inner">
    				 <p><?php echo $options['boxcontent']; ?></p>
    					<p><a href="#" id="pea_close"><?php echo $options['closelink']; ?></a></p>
    				</div>
    			</div>
    
    			<script type="text/javascript">
    				jQuery(document).ready(function($){
    					$("#fom").click(function() {
    					  $(".pea_cook_more_info_popover").fadeIn("slow");
    					  $(".pea_cook_wrapper").fadeOut("fast");
    					});
    					$("#pea_close").click(function() {
    					  $(".pea_cook_wrapper").fadeIn("fast");
    					  $(".pea_cook_more_info_popover").fadeOut("slow");
    					});
    					$('#pea_cook_btn').click(function() {
    						var today = new Date();
    						var expire = new Date();
    						var expireTimer = <?php echo $expireTimer?>;
    						expire.setTime(expire.getTime()+".expireTimer.");
    						var expires = "; expires="+expire.toGMTString();
    						//document.cookie = "peadigCookie=set;";
    						document.cookie = "peadigCookie=set;"+expires+"; path=/";
    					$(".pea_cook_wrapper").fadeOut("fast");
    					});
    				});
    			</script>
    	<?php
    		}
    	}
    }
    add_action('wp_footer', 'peadig_eucookie_bar', 1000);
    ?>
  8. Lumb
    Member
    Posted 1 year ago #

    Excellent - thanks for your time Wil - much appreciated! :)

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.