Hustle popup is displaying for all Countries but I selected only Australia

I'm trying to show a popup to ONLY Australia, but it's showing up for everyone. I've created a test copy of the site and disabled ALL plugins but the issue persists. I also test it with default theme.
We're on Cloudways with Varnish, Apache and NGINX running from behind CloudFlare if that helps.

  • Dimitris

    Hello there QuickFix,

    hope you're doing good today! :slight_smile:

    I just tried to replicate this in a live website of mine, which also uses Cloudflare (via HummingBird's integration), but I'm still unable to reproduce this so far... each time my country selection in Hustle settings was being used successfully.

    I can see that you've deactivated all other plugins, and I really appreciate this. Can I also try to activate a default theme like TwentySeventeen to ensure that this isn't coming from it?

    Finally, please do activate the "development mode" in your Cloudflare account, so we don't get any cached content from it. Here's how:
    https://support.cloudflare.com/hc/en-us/articles/200168246-What-does-Cloudflare-Development-mode-mean-

    Warm regards,
    Dimitris

  • QuickFix

    Hi there, thanks for the reply.

    I can confirm the problem exists using the Twenty Seventeen theme. You guys should have admin logins to this test site, so please change or do whatever you feel is necessary to troubleshoot. I have also disabled the orange cloud for the test.starlight.org domain; you shouldn't see any interference from CloudFlare now.

    We are on CloudWays which runs Apache, NGINX and Varnish if that helps. I feel like there might be something with NGINX that's causing this (doesn't it act as a kind of reverse proxy?), but I don't know enough about it or how your plugin works to investigate.

    Please let me know how else I can help.

    Thanks!

  • Ivan

    Hi QuickFix !

    It seems the FTP credentials which you provided doesn't work.
    If you provide me with additional login credentials, I can look into it more.

    https://premium.wpmudev.org/contact/#i-have-a-different-question
    Please visit our private Contact page and complete the form with the following information:

    Subject: "Attn: Ivan Svyrskyi"

    In the Message box, please provide the following:

    link back to this thread for reference
    any other relevant urls

    FTP/SFTP credentials
    host
    username
    password
    (and port if required)

    Note: Don't send any credentials via this forum because it's public forum.

    Best,
    Ivan.

  • Ivan

    Hi QuickFix !

    It was SFTP, it works, thank you!
    I added some changes to your site. If you have the same issue on another site - you can change get_user_ip function into {wordpress_folder}/wp-content/plugins/hustle/inc/opt-in-geo.php file via FTP (approximately 53rd line) from

    public function get_user_ip() {
    	static $ip_address = null;
    
    	if ( null === $ip_address ) {
    		if ( getenv( 'HTTP_CLIENT_IP' ) ) {
    			$ip_address = getenv( 'HTTP_CLIENT_IP' );
    		} else if ( getenv( 'HTTP_X_FORWARDED_FOR' ) ) {
    			$ip_address = getenv( 'HTTP_X_FORWARDED_FOR' );
    		} else if ( getenv( 'HTTP_X_FORWARDED' ) ) {
    			$ip_address = getenv( 'HTTP_X_FORWARDED' );
    		} else if ( getenv( 'HTTP_FORWARDED_FOR' ) ) {
    			$ip_address = getenv( 'HTTP_FORWARDED_FOR' );
    		} else if ( getenv( 'HTTP_FORWARDED' ) ) {
    			$ip_address = getenv( 'HTTP_FORWARDED' );
    		} else if ( getenv( 'REMOTE_ADDR' ) ) {
    			$ip_address = getenv( 'REMOTE_ADDR' );
    		} else {
    			$ip_address = 'UNKNOWN';
    		}
    	}
    
    	return $ip_address;
    }

    to

    public function get_user_country() {
    	// Grab the users IP address
    	$ip = $this->get_user_ip();
    
    	// See if an add-on provides the country for us.
    	$country = apply_filters( 'wpoi-get-user-country', "", $ip );
    
    	if ( empty( $country ) ) {
    		$country = $this->get_country_from_ip( $ip );
    	}
    
    	if ( empty( $country ) ) {
    		$country = 'XX';
    	}
    
    	return $country;
    }

    Also, I'll provide this change to implement the next version of the plugin.

    Best,
    Ivan.

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.