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
Comment #1
arpeggio CreditAttribution: arpeggio commented@voodootea
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.
Comment #2
bsandor CreditAttribution: bsandor commentedsubscribing
Comment #3
nyleve101 CreditAttribution: nyleve101 commentedsubscribing
Comment #4
nyleve101 CreditAttribution: nyleve101 commentedArpeggio, would it be possible to sponsor this development? If so, how much would be involved?
Comment #5
arpeggio CreditAttribution: arpeggio commented@nyleve101, I have sent a message to your contact form. Thanks.
Comment #6
arpeggio CreditAttribution: arpeggio commentedI have implemented this feature. Please use version 6.x-1.3. Thanks to @nyleve101 for sponsoring this feature.
Comment #8
voodootea CreditAttribution: voodootea commentedThats 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.
Comment #9
semei CreditAttribution: semei commentedAny news on this? This would be a great feature for D7 as well!
Comment #10
loopduplicateHi semei,
It's in the D7 dev branch: http://cgit.drupalcode.org/smart_ip/commit/?id=c1f8b56c2bf4327ffd28b9252...
Cheers,
LoopDuplicate
Comment #11
birdsnbees CreditAttribution: birdsnbees commentedIt seems the Drupal 7 version is already implemented #2591627: Drupal 7 support of openlayers_proximity module's views field, filter and sort.