Hello. I was getting this same problem today with the popup showing multiple times. I even rewrote your code to try and find out why :
var show_pop_up = false;
if('<?php echo get_option("displetpop_testmode"); ?>' == '1')
{
// we are in test mode. we want to show popup no matter what;
show_pop_up = true;
}
else
{
// if the cookie has not been set let's go and check if we are to show it
if( $.cookie('displetpop_recentpop') != 'yes' && <?php echo $_SESSION["views"]; ?> >= <?php echo get_option("displetpop_pageviews"); ?>)
{
// cookie not set but the user has seen enough pages
// move the below logic into this "if" statement as we only need to run it, if the popup hasn't already shown
var displetpoppathhome = '<?php echo get_option('displetpop_homepage_path'); ?>';
var displetpoppath1 = '<?php echo get_option('displetpop_path'); ?>';
var displetpoppath2 = '<?php echo get_option('displetpop_path2'); ?>';
var displetpoppath3 = '<?php echo get_option('displetpop_path3'); ?>';
if(displetpoppathhome == '' &&
displetpoppath1 == '' &&
displetpoppath2 == '' &&
displetpoppath3 == '')
{
show_pop_up = true; // show pop up as admin says 'Leave blank to apply to all pages & posts'
}
if (displetpoppathhome == '1'){
if('<?php echo is_front_page(); ?>' == '1') {
show_pop_up = true; // we want to show the popup on the homepage, and we are on the homepage
}
}
if (displetpoppath1 != ''){
if(window.location.href.indexOf(displetpoppath1) > -1) {
show_pop_up = true;
}
}
if (displetpoppath2 != ''){
if(window.location.href.indexOf(displetpoppath2) > -1) {
show_pop_up = true;
}
}
if (displetpoppath3 != ''){
if(window.location.href.indexOf(displetpoppath3) > -1) {
show_pop_up = true;
}
}
// this logic '<?php echo current_user_can("manage_options"); ?>' == '1'
// To be honest I don't know what his is doing so removed it in my version of your code.
}
}
if (show_pop_up){
window.setTimeout(displetPop, <?php echo 1000*get_option('displetpop_seconds'); ?>);
}
That code works. But it turns out that I didn’t need to rewrite the code ?? You were overwriting the cookie in the if statement. You had
if ((($.cookie('displetpop_recentpop', {path:'/'}) != 'yes'
which would always be true thus the popup would always appear. My code above is slightly better (cause I have a big head) as it doesn’t need to do a lot of the logic all the time, and is easier to read ?? But changing the if statement to
if ((($.cookie('displetpop_recentpop') != 'yes'
would also make the pop not appear more than once in the cookie life time.