Hello, Pretty new to the community but I'm facing an issue where I need to have the visitor location IP address filled in as the start address on a google maps direction lookup.

I'm building a View with this plugin but the start address, the visitor IP specifically, is not an available token.

Available tokens are:

  • title] == Content: Title
  • [latitude] == Location: Latitude
  • [longitude] == Location: Longitude
  • [address] == Location: Address
  • [nothing] == Global: Custom text

These are specific to whatever the view is populating, obviously, but it would be enourmously helpful to add tokens that will populate the visitor's current location information.

Does this have to be custom built as a custom token or is there another workaround I haven't thought of.

Thanks!

Comments

rdeboer’s picture

Hi Alex,
You've had an account for nearly 2.5 years... that's not that new.... But welcome!

Great idea!

Yes module code would have to be added to provide these tokens. If I had more spare time I'd have a crack at it now.
Or you can commission the work.

Rik

rdeboer’s picture

Title: IP Geolocation, Reverse-geocoding fields in Views » Reverse-geocoding location tokens for use in fields in Views

Still a great idea.
Still no time.
Anyone?

dmegatool’s picture

Just stubbled on this topic.

@AlxVallejo: Maybe you could do it like I did ? https://www.drupal.org/node/2425389#comment-9617075

If it's reverse-geocoded by google, you get a full address to you can use whatever to build your starting point. You get that kind of array :

Array
(
    [provider] => google
    [ip_address] => 
    [latitude] => 46.8087412
    [longitude] => -71.3119905
    [accuracy] => 8208
    [formatted_address] => 3660 Boulevard Wilfrid-Hamel, Québec, QC G1P 1J4, Canada
    [street_number] => 3660
    [route] => Boulevard Wilfrid-Hamel
    [neighborhood] => Duberger-Les Saules
    [sublocality_level_1] => Les Rivières
    [locality] => Québec
    [administrative_area_level_2] => Communauté-Urbaine-de-Québec
    [administrative_area_level_1] => Québec
    [country] => Canada
    [country_code] => CA
    [postal_code] => G1P 1J4
)
rdeboer’s picture

Assigned: Unassigned » rdeboer
Status: Active » Closed (fixed)

Fixed some time ago, see screenshot in #1882214: Expose visitor location tokens to other modules.