I was trying to use smart ip to load latitude and longitude for proximity filter on view but It was returning nothing.

I found that $_SESSION did not hold the latitude and longitude for the persons ip like it was supposed to (not exactly sure why)

I fixed it by using smart_ip_session_get('smart_ip');

Proposed resolution

file: location.views.inc
line 585

if (module_exists('smart_ip')) {
  $smart_ip_session = smart_ip_session_get('smart_ip');
  if (isset($smart_ip_session['location']['latitude']) &&
    isset($smart_ip_session['location']['longitude'])) {
    $coordinates['latitude'] = (float) $smart_ip_session['location']['latitude'];
    $coordinates['longitude'] = (float) $smart_ip_session['location']['longitude'];
  }
}
CommentFileSizeAuthor
#2 2011196-smart-ip-2.patch4.61 KBpodarok
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

pribeh’s picture

@UziTech, thanks for this code. It helped me resolve the same issue using views 3.3. I'm not positive but I think this isn't working with views 3.7. What version are you using?

podarok’s picture

Version: 7.x-3.0-rc1 » 7.x-3.x-dev
Status: Patch (to be ported) » Needs review
FileSize
4.61 KB

here is a patch for this

podarok’s picture

Status: Needs review » Fixed

#2 commited pushed to 7.x-3.x
thanks!

Status: Fixed » Closed (fixed)

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