"Not on specific URL" functionality is not working

SLS needed.
I have the PopUp Pro plugin installed and for some reason, the "Not on specific URL" functionality is not working on my production site, it is, however, working on my development website. The popup is set to "inactive" on the live site at the moment since I couldn't find a way to hide it from specific pages. However, I left it "active" on the development site.

    Panos

    Hey there @ken!

    I would need to have a closer look and do some testing by adding some checkpoints and see if the url rules are reached or for some reason missed.

    I would need ftp and admin access for this. You can send access info privately through our contact form: https://premium.wpmudev.org/contact/#i-have-a-different-question

    Send in:Subject: "Attn: Panos Lyrakis"

    - Admin login:
    Admin username
    Admin password
    Login url

    - FTP credentials
    host
    username
    password
    (and port if required)

    - link back to this thread for reference

    Could you also post back here once you have sent these credentials so I get notified faster?

    Thanks!

    Ken

    Hello Panos,

    I have sent the information through the contact form with the requested format you provided above.

    Something to note:

    **** Please do not deactivate ANY plugins or themes. We are a business and we need to have the site fully operational. Please do not modify any WordPress core files or theme files, if you do modify a theme file for testing (console logs for example), please revert back after you discover what is causing the issue. Obviously feel free to modify the popup plugin code, l am more concerned with the theme files and custom plugins we have developed. We use GitHub to backup the website, if you do modify a file, please let me know which files I will need to backup.

    Thanks,
    Ken

    Ken

    Hello Panos,

    After further testing I discovered something. I initially thought that the "NOT ON SPECIFIC URL" functionality was always working on the development site but after testing over https that appears to be an issue.

    For example:
    The contact us page doesn't show the pop up with http: http://annuityadv.staging.wpengine.com/contact-us/

    The contact us page does show the pop up with https:
    https://annuityadv.staging.wpengine.com/contact-us/

    The live site is served always over https, so this is why the pop up always shows even on pages we intentionally omit.

    I thought I would add in this information as it seems to be a plugin issue.

    Thanks,
    Ken

    Panos

    Hi Ken ,

    That's true, when updatig plugins/themes, such modifications get lost as files are being replaced.

    First thing I'm trying to find out is if this fix works on your live site too. On your staging site, the site url and home are set to http://yourstagingsite.com and not https. You can see this from the admin > Settings > General and in your wp-config.php

    When the plugin tries to fetch the current url it checks the port, for https it should be using 443 by default. Since it's not been configured to use the 443 port, it uses port 80. The plugin will add this port in the url changing it from
    https://yourstagingsite.com
    to
    https://yourstagingsite.com:80
    and this is the reason the plugin is not applying the url rule you have entered, since it is comparing the urls set in rules with the current url which includes the port.

    The first simplest way is to duplicate the urls in your rules by adding the port. I wouldn't recommend this, as you will need to keep this in mind in future rules.

    The second simplest way to go through it, is to simply remove the port number when checking the rule. As you said this will be replaced in next update, so lets go with a different approach.

    For a more permanent solution, in that same file we can apply some filters which can modify the url from a mu-plugin, so the changes are not lost on updates. I have already made this modification on your staging site, and I am attaching here the same file which includes the url filters. This change should be included in next plugin update so you won't be loosing it.

    Now that you have the file with the filters, you can add the following in a mu-plugin or your theme's functions.php:

    add_filter( 'popup/apply_url/url', 'wpmudev_rm_port_from_current_url', 10, 1 );
    add_filter( 'popup/apply_no_url/url', 'wpmudev_rm_port_from_current_url', 10, 1 );
    
    function wpmudev_rm_port_from_current_url( $url ){
        return str_replace( ':80', '', $url );
    }

    Cheers!

    Ken

    Hello Panos,

    I tested the new file class-popup-rule-url.php on the live site and it doesn't appear to be working. I uploaded the file here wp-content/plugins/popover/inc/rules/class-popup-rule-url.php and overwrote the existing file. I also added the filters & function code to the functions.php file. Even after adding the code to the functions.php file and uploading the file it still doesn't work on the live site, I have tried clearing my cache and even flushing the cache with our CDN provider.

    However, version one of the class-popup-rule-url.php that you provided earlier DOES fix the issue and is working properly on both the live site & development site. It appears that the issue now is with the version two of the code you provided. Out of curiosity, why doesn't your internal team just push version one of this update to the plugin and that way we don't have to worry about future updates overwriting our changes?

    Another question, doesn't the version two option with the functions.php code only work if we have already replaced the class-popup-rule-url.php file within the plugin that contains the additional code, if in the future the plugin is updated omitting or overwriting that code, the filters would have nothing to hook into, correct?

    So, it seems to me that either fix, version one OR version two, would break if a new plugin update is pushed that no longer contains the necessary additional code in the class-popup-rule-url.php file. If my assumption is correct, I don’t understand what we are gaining with the version two that you most recently provided versus the first version one fix? Your thoughts?

    I have been trying to get this plugin to work now for several weeks. For now, I’m going to use the version one solution because it is working. But I am really trying to avoid running into a problem when the inevitable time comes that the plugin is updated and our changes are lost. Please advise.

    Thanks,
    Ken

    Panos

    Hey Ken ,

    It's weird that the second file with the hooks isn't working as it works on your staging site. I would need ftp access to your live site to see what is going on there. You can send ftp and admin credentials as previously.

    I don’t understand what we are gaining with the version two that you most recently provided versus the first version one fix?

    Sorry for not being clear. The first fix is very specific and can't be included in a plugin release, so you'll need to repeat fix after each update. However the filters added in the second file I shared:
    $url = apply_filters( 'popup/apply_no_url/url', $this->current_url() );
    will be included in next release. So if you are using the custom code in your functions.php ( or a mu-plugin ) it will still work after plugin update.

    Hope I could explain better this time

    Now the important thing is to see why it's not working on your live site, but as I said I would need to have a look there. Please post back here when you send in credentials so I can get informed faster!

    Thanks!

    Ken

    Hello Panos,

    We can work on the "hooks" and try to resolve that but first an even larger issue has arisen. The cookies are not being stored when the options ("Never see this message again" settings) are set. This functionality is the main reason I am even using this plugin. The issue is AGAIN with the live site and not with the development site... The "Hustle Plugin" is working perfectly so I considered switching to that but the styles are different and I am having a hard time making it look the same.... It also has a strange "jump" effect when it is activated and mobile is an inconsistent experience.

    Panos

    Hi Ken ,

    Sorry for late reply !

    I would suggest the switch to Hustle as it has more features that could be useful, plus it is working and the issues you mention are smaller than with popup, however it's up to you

    We can work on the styling on Hustle but I haven't seen any report about the jump effect. For that I should ask the devs. Also which are the inconsistencies you have noticed on mobile screens?

    Please let us know if you will continue with PopUp Pro or Hustle so we can do further investigation.

    Thanks!