WordPress.org

Ready to get started?Download WordPress

Forums

Custom Content by Country (by iControlWP)
[Plugin: Custom Content by Country, from Worpit] Not Working (7 posts)

  1. sharon
    Member
    Posted 1 year ago #

    Hi. I don't seem to be able to get the plugin to work.

    I want to display certain content to those in Great Britain, Ireland but not to those in the USA. This is the code I have used

    [CBC country="gb, ie, im" show="n"]England [/CBC]
    [CBC country="usa" show="y"]USA[/CBC]

    It shows the content "England" to every country (tested France, England, USA) but does not show content "USA" to those in the USA or England or France.

    I also tried just using

    [CBC country="gb, ie, im" show="y"]England [/CBC]

    This does not show content to anyone.

    Would this be a problem with the database, theme (I'm using Weaver II) or something that I'm doing wrong?

    Thanks in advance.

    http://wordpress.org/extend/plugins/custom-content-by-country/

  2. Paul G.
    Member
    Plugin Author

    Posted 1 year ago #

    Hi Sharon,

    I think the problem here is the country code you're using for the USA.. it's 'us' I believe.

    From what you have said, what you would want is:

    [CBC country="gb, ie, im" show="y"]England[/CBC]
    [CBC country="us" show="y"]USA[/CBC]

    This will mean that anyone who is coming from gb, ie, im and us will not get any content here, so you might want default piece of content like this:

    [CBC country="gb, ie, im, us" show="n"]Everyone Else[/CBC]

    Check out the table on this page for a full list of country codes:
    http://en.wikipedia.org/wiki/ISO_3166-1

    I hope otherwise, the plugin is working well for you.

    Cheers,
    Paul

  3. sharon
    Member
    Posted 1 year ago #

    Hi, thanks for your speedy response.

    I'm still having issues. I have tried what you suggested.

    [CBC country="gb, ie, im" show="n"]England[/CBC]
    [CBC country="us" show="y"]USA[/CBC]
    [CBC country="gb, ie, im, us" show="n"]Everywhere else[/CBC]

    and also

    [CBC country="gb, ie, im" show="y"]England[/CBC]
    [CBC country="us" show="n"]USA[/CBC]
    [CBC country="gb, ie, im, us" show="n"]Everywhere else[/CBC]

    When my location is in the UK I see :
    England

    Everywhere else

    USA
    Everywhere else

    When I set my location via a VPN to be in the USA or France I see exactly the same.

    It seems that when show="n" I see the content but not when show="y"

    Cheers
    Sharon

  4. Paul G.
    Member
    Plugin Author

    Posted 1 year ago #

    Hi Sharon,

    I don't think you saw what I wrote properly... you need to use show="y" for the first two, and then show="n" for the final one. You haven't got that in your code examples...

    Also, another thing to consider, as a developer, is that the plugin, since the latest version, is using cookies to store the results of the country data. Perhaps in a future version I'll provide a plugin option to allow you to toggle this on/off for development purposes. If you have Google chrome, you'll be able to easily delete the cookie data between your tests.

    Also, while this database is fairly accurate, it's not completely 100% and does have I believe a few exceptions.

    The database is taken from: http://www.ip2nation.com/ip2nation try putting in your IPs there and see which country comes out. If you're using it exactly as follows:

    [CBC country="gb, ie, im" show="y"]England[/CBC]
    [CBC country="us" show="y"]USA[/CBC]
    [CBC country="gb, ie, im, us" show="n"]Everyone Else[/CBC]

    and on the ip2nation.com website it's returning the correct response for the countries given your testing IP addresses, can you email me with your IP addresses that you're using and your exact results and I'll run a few tests against the code.

    Of course, please ensure you're deleting the cookie data for the plugin between tests.

    I hope all that helps get it all sorted.

    Thanks,
    Paul.

  5. Paul G.
    Member
    Plugin Author

    Posted 1 year ago #

    Hi Sharon,

    Actually, to help you with this, I just added a new option to the plugin options screen.

    It's called "Developer Mode". Simply enable this, and then clear your cookie data for the site and it wont set any cookies for you (or anyone else). This way it will always perform the SQL query while you test to ensure you're not using cached data.

    You'll want to turn developer mode off though once you're ready.

    Let me know how that works for you.

    Cheers,
    Paul.

  6. sharon
    Member
    Posted 1 year ago #

    Thanks, it still doesn't work. I've tried it on a number of other sites that use different themes and used a different computer to check if it is working. And I experience the same problem. Only content which is set to show="n" is displayed. Are their any incompatibilities with other plugins?
    Thanks
    Sharon

  7. Paul G.
    Member
    Plugin Author

    Posted 1 year ago #

    Hi Sharon,

    Sorry for the huge delay in getting to look at this.

    I have reviewed the code, and done a lot of testing with show=y and show=n and manually set country codes etc., but I haven't been able to replicate this at all. It works for me exactly how it's documented to.

    I have added a data tag to the output called "data-detected-country" so if you inspect the source, you'll see something like:
    data-detected-country="us" on the HTML span that will tell you the country code that the plugin detected, either from a cookie or cloudflare or from the IP address.

    Perhaps that might help in debugging it. Sorry I can't be of further assistance than that.. unless I can replicate the bug, I can't fix it.

    Thanks,
    Paul.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.