In trying to integrate this module with Device Geolocation (Smart IP) modules, there is no way to dynamically set the location based on user's IP address. Since the Smart IP module presents SESSION variables, is there anyway to dynamically return these values into the location field. I've managed to hardcode these by hacking the file 'openlayers_proximity_handler_filter.inc' and changing default value from 'blank' in line 55 to
$options['value']['contains']['location'] = array('default' => $_SESSION['smart_ip']['location']['city']);
however all this does is automatically assigns the current user (admin)'s location into the location field in views filters when building the view, and saves this value as per normal into the field in DB views_object_cache table. So each time the block is shown, again the stored location and not the current (IP) location is used
Im I going about this right way? Is there some sort of patch to allow PHP code to be used to set the location in 'filter'.. Then I could use some thing like
return array('latitude' => $_SESSION['smart_ip']['location']['latitude'], 'longitude' => $_SESSION['smart_ip']['location']['longitude']); from http://drupal.org/node/1007942
Please help, as I really don't want to have to resort to using the 'location' module for various reasons..
Thanks
Comments
Comment #1
noahlively commentedI wonder if you could use hook_form_alter() to accomplish the same thing and bypass the caching. I'm trying to do something similar on a project. I'll try this and let you know if and how it works for me.
Comment #2
noahlively commentedSo far the following has worked for me (in a dev environment... not used in production yet):
It pre-fills the exposed form with the user's auto-geocoded zip. I'm using the "ip_geoloc" module to do the automatic geocoding.
Comment #3
socialnicheguru commented#2 where did you place the code? custom module?
Edit: just a hook_form_alter. I wonder if it is the same in D7