Index: handlers/location_views_handler_filter_proximity.inc =================================================================== --- handlers/location_views_handler_filter_proximity.inc (revision 144) +++ handlers/location_views_handler_filter_proximity.inc (working copy) @@ -130,6 +130,13 @@ class location_views_handler_filter_prox ), '#default_value' => $this->value['search_units'], ); + + $form['value']['get_origin_from_url'] = array( + '#type' => 'checkbox', + '#default_value' => $this->value['get_origin_from_url'], + '#title' => t('Obtain origin from url'), + '#description' => t('Using this option will attempt to obtain a latitude and longitude from either the current node or user page.'), + ); } function exposed_form(&$form, &$form_state) { @@ -181,6 +188,17 @@ class location_views_handler_filter_prox return false; } } + + if ($this->value['get_origin_from_url']) { + if (arg(0) == 'node' && is_numeric(arg(1)) && $node = node_load(arg(1))) { + $this->value['latitude'] = $node->location['latitude']; + $this->value['longitude'] = $node->location['longitude']; + } + elseif (arg(0) == 'user' && is_numeric(arg(1)) && $user = user_load(arg(1))) { + // @todo get user location + } + } + if (empty($this->value['latitude']) || empty($this->value['longitude'])) { return false; }