How to edit "show once per year" code

mpbiz

New member
Apr 29, 2010
2,825
57
0
I just installed a wordpress plugin that redirects users to a "welcome gate" (think groupon and appsumo), but it only shows it to the user once per year.

I need to make it so that it shows up for them 100% of the time. This way no matter who is coming to my site, whether they've already opted in, etc. they will always hit this welcome gate.

Here's the code that I think needs to be modified but not sure how to accomplish this.

Code:
$service_cfg = $this->wg_options->opt['wg_services'][$wg_service];
            $wg_form_action = $service_cfg['url'];
            $wg_input_name = $service_cfg['input_name'];
            $wg_configured = $service_cfg['configured'];
            $wg_service_fields = $service_cfg['fields'];
            $wg_ver = $this->wg_options->get_url_ver();
            $wg_has_lp = $this->wg_options->video_player && $wg_lp_enable;
            if ($wg_has_lp) {
                $lp_shortcode = PlayerVideo::insert_video(array('id' => $wg_video));
            }
            // cookies
            setcookie('lb-wp-splash-page', '1', time()+60*60*24*365);
            // include template
            include(LB_WG_PLUGIN_DIR . "/templates/" . $temp . "/index.php");
            die();
        }
        
        /**
Thanks for the help.
 


comment out this line:

setcookie('lb-wp-splash-page', '1', time()+60*60*24*365);

edit for why: You want to comment out that line because it's setting the cookie "lb-wp-splash-page" to "1" (true) and setting an expiration of a year from now. Commenting out that line will mean the cookie never sets and voila, you're raping your visitors with a popup on every single page of your site for some reason.
 
comment out this line:



edit for why: You want to comment out that line because it's setting the cookie "lb-wp-splash-page" to "1" (true) and setting an expiration of a year from now. Commenting out that line will mean the cookie never sets and voila, you're raping your visitors with a popup on every single page of your site for some reason.

Thanks dchuk but its causing a fatal error in the plugin. Is there any way I can set the cookie for 1 second or something to game the cookie expiration?
 
Does the site in question have multiple pages. If so, you'll end up showing this to your users everytime they hit a page thereby lowering the CTR/conversions and a skyrocketed bounce rate.

Your best bet would be to set a cookie with a 1 hour lifespan. So if the prospect visits your site again in an hour, he'll be shown a popup again.

PHP:
setcookie('lb-wp-splash-page', '1', time()+3600);
 
Can't tell from here. Show the chunk of code that defines $temp, and the few lines above / below it.