We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Block Certain Countries

How Do I?

xcl's avatar
xcl
104 posts
4 years ago
xcl's avatar xcl

Hi all,

Wondering if there is a recommended or good way to implement this at the EE level? Considered webserver but that wouldn’t give the outcome as desired.

I’d like to show x countries the main content but y countries other content.

Some of what we do is territory specific.

Can’t find any plugins that would do this out of the box so curious to see if anyone else has come across this requirement.

Thanks!

       
Rob Allen's avatar
Rob Allen
2,950 posts
4 years ago
Rob Allen's avatar Rob Allen

Showing / not showing content to specific countries you’d probably have to do some IP address lookups and have relevant tags/conditionals in your templates - that does sound like you’d need a custom addon to do the job.

       
xcl's avatar
xcl
104 posts
4 years ago
xcl's avatar xcl

Would https://docs.expressionengine.com/latest/add-ons/ip-to-nation.html#banning-countries not be suitable? I’ve only just found this.

I have tried it although it appears to be buggy as the Maxmind download does not work.

I get a message unable to connect to Maxmind and there are no docs on how to manually update it.

       
Rob Allen's avatar
Rob Allen
2,950 posts
4 years ago
Rob Allen's avatar Rob Allen

I don’t think the IP to nation module would work because it doesn’t have a facility to show alternative content to alternative countries like you want to do.

       
xcl's avatar
xcl
104 posts
4 years ago
xcl's avatar xcl

I’m sure it could be used as a starting point, if it is already doing lookups. We’d just need to refactor it a little.

Although as it does not appear to work (getting the Maxmind updates), does it need to be reviewed as a non-working add-on in its own right?

       
Rob Allen's avatar
Rob Allen
2,950 posts
4 years ago
Rob Allen's avatar Rob Allen

The IP to nation module doesn’t have any template tags/variables that can be used the way you want, but there’s no reason why you can’t write a custom module that uses IP to nation as a base, and extend the way you want it to work.

I know the Maxmind issue was raised a while back, I’m not sure if there’s been any progress on it since I don’t use it. Saying that I just found https://expressionengine.com/add-ons/ip-geo-locator in the addon store, that might be worth a look, it seems to do “if allowed” with TRUE/FALSE which you could use to show alternative content for matching IP’s.

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.