In trying to integrate the Openlayers Proximity module with Device Geolocation (Smart IP) D6 modules, in the views filter, there is no way to dynamically set the location based on user's IP address - it always has to be fixed or contextual. 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

arpeggio’s picture

@voodootea

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

The code snippet at http://drupal.org/node/1007942 uses location module. Unfortunately, there's no code snippet that can be used at views filter without using a module like location module. If location module is not your preference, then we need to do development to add views filter feature to Smart IP.

bsandor’s picture

subscribing

nyleve101’s picture

subscribing

nyleve101’s picture

Arpeggio, would it be possible to sponsor this development? If so, how much would be involved?

arpeggio’s picture

@nyleve101, I have sent a message to your contact form. Thanks.

arpeggio’s picture

Status: Active » Fixed

I have implemented this feature. Please use version 6.x-1.3. Thanks to @nyleve101 for sponsoring this feature.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

voodootea’s picture

Thats amazing.. thanks guys for making this a reality. There is now a drupal 7.x version of this module in 'sandbox' http://drupal.org/sandbox/jpstrikesback/1367194 that does work, i was wondering if there was any possiblity to add the same functionality of smart IP and/or device geolocation to that? I have already made a request with the developer here.. http://drupal.org/node/1578294

Many thanks.

semei’s picture

Any news on this? This would be a great feature for D7 as well!

loopduplicate’s picture

Hi semei,

It's in the D7 dev branch: http://cgit.drupalcode.org/smart_ip/commit/?id=c1f8b56c2bf4327ffd28b9252...

Cheers,
LoopDuplicate

birdsnbees’s picture