ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Ip to nation within templates?

July 21, 2010 11:33am

Subscribe [4]
  • #1 / Jul 21, 2010 11:33am

    outline4

    271 posts

    is there an add-on that will detect the ip of a user and get’s it’s nation for use within conditionals… or is there even an add-on that would detect the continent?
    can somebody block it’s IP actually?

    I would like to use the add-on in a similar way:

    {assign_variable:var_continent="{exp:ip_to_continent lang="de"}"}
    {assign_variable:var_country="{exp:ip_to_country lang="de"}"}
    
    {if {var_continent} == "Europa"}
     {if {var_country} == "Schweiz"}
       {embed=".currency/.ch"}
     {if:else}
      {embed=".currency/.euro"}
     {/if}
    {if:elseif {var_continent} != "Europa"}
      {embed=".currency/.dollar"}
    {if:elseif {var_continent} == ""}
     why do you block your ip?
     you cannot shop here until you show your ip…
    {/if}

    I would need to detect if an IP is from europe, a specific country in europe, or any other continent.

    if not, is someone willing to code one?
    please make an offer…

    cheers
    outline4

  • #2 / Jul 21, 2010 12:47pm

    Boyink!

    5011 posts

  • #3 / Jul 21, 2010 1:30pm

    outline4

    271 posts

    http://ellislab.com/expressionengine/user-guide/modules/ip_to_nation/index.html

    hi boyink,

    well… I thought of that too… but you cannot use it the way I intend to.
    to my knowledge, there’s only {exp:ip_to_nation:world_flags} template tag?!

    so, to my understanding, the ip to nations module is only for banning users from comments or show country flags within comments.
    I mean, you’re the teacher, not I 😉 tell me if I’m wrong!

    cheers
    stefan

  • #4 / Jul 21, 2010 1:48pm

    Boyink!

    5011 posts

    Ah -thought there was more to that module.  Maybe it’s a starting point for someone.  Cruising through Devot-ee I don’t see much help either.

  • #5 / Jul 21, 2010 2:07pm

    outline4

    271 posts

    Ah -thought there was more to that module.  Maybe it’s a starting point for someone.  Cruising through Devot-ee I don’t see much help either.

    yeah, no addon in sight!
    I might have to contract someone to write one… or do you know of any solution to this?

  • #6 / Aug 06, 2010 1:37pm

    sedev

    14 posts

    Hey Stefan,

    Actually, the IP to nation module has a type=“text” option, which returns the country name. You would use it like this:

    {exp:ip_to_nation:world_flags type=“text”}{ip_address}{/exp:ip_to_nation:world_flags}

    Make sure you test it on a live server, as it won’t work in a local dev environment (IP 127.0.0.1, or whatever)

    Cheers,

    Séamus

  • #7 / Aug 18, 2010 11:22am

    outline4

    271 posts

    Hey Stefan,

    Actually, the IP to nation module has a type=“text” option, which returns the country name. You would use it like this:

    {exp:ip_to_nation:world_flags type=“text”}{ip_address}{/exp:ip_to_nation:world_flags}

    Make sure you test it on a live server, as it won’t work in a local dev environment (IP 127.0.0.1, or whatever)

    Cheers,

    Séamus

    wow, this actually works!
    where did you found out about this one? doesn’t seem to be documented…

    thanks a lot!
    stefan

  • #8 / Aug 18, 2010 11:44am

    sedev

    14 posts

    Hi Stefan,

    I think I came across it on the Cartthrob forum, while trying to solve a currency conversion problem. It IS actually in the documentation though, right at the very end. I had missed it as well.

    Cheers,

    Seamus

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases