I am attempting to use the location of each user (by way of the smart ip module) to center the map upon loading. So far it seems to be converting the IP to lat/long and storing them in the variables
$_SESSION['smart_ip']['latitude']
$_SESSION['smart_ip']['longitude']
Is there a way to override the gmap default settings and use these variables if they exist for given user, otherwise use the default settings?
I am currently using the location and view modules, among others.
I appreciate any help that can point me in the right direction.
| Comment | File | Size | Author |
|---|---|---|---|
| #7 | gmap_php_macro-1051914.patch | 513 bytes | javi.pl |
Comments
Comment #1
asutton commentedI am trying to use the following code in the GMap view macro box:
[gmap zoom=3
|center=
|width=600px
|height=400px |control=Small |type=Map]
PHP filter is enabled in modules.
this macro breaks my map and does not show default settings. any help is appreciated!
Comment #2
asutton commentedproblem solved. the issue was with my filters being out of order.
Comment #4
andrea.cavattoni commentedi cant solve the same problem, can u help me?
Comment #5
mmll commentedHave been around wondering for quite a bit already how to set lat&long got from user ip for default map.
I'm newby in code but can handle if pointed in concrete direction.
I have Smart IP and PHP filter installed, using D7 though.
This issue is closest I got. #1 didnt work for me.
I played around with it, also tried to paste it into macro to generate node/map to see what happens in. I got error (no map zoom etc).
Comment #6
javi.pl commentedI had the same problem.
Solution -> add patch (this patch allow to implement php into macro, tested only in views )
Macro example:
[gmap align=Center |zoom=10 |center=
|width=100% |height=600px |control=Small |type=Map]
I had also problem with "Smart_ip" module. If that's a problem check if you have proper $_SESSION['smart_ip'] variable.
dpm($_SESSION['smart_ip']); (you need to have devel module instaled)
Comment #7
javi.pl commented