Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I have a site that requires to search for lat long information before been saved / updated a member profile, this is searched from google on reverse geolocation through a custom file name location.

I am not looking the function on solve that, I ma looking way on hook the function

Any suggest on how to solve that?

share|improve this question
2  
Hm, are you sure you want to do this before update? Why exactly? It is usually easy in WP inserts to hook right after it happened, but right before is challenging. –  Rarst Jan 6 at 22:22
    
Cause I need user enter some location info and then make a map for all users, then I will need a latlong key pair for display positions on a map –  Carlos Jan 7 at 0:17
    
I am sorry, that doesn't quite explain to me why before rather than after matters. Maybe you could provide your data flow for this step by step? –  Rarst Jan 7 at 0:53

1 Answer 1

you can use something like this

/**
 *  Get City state from zipcode
 */
function rtp_get_city_state($location) {

    $details_url = 'http://maps.google.com/maps/api/geocode/json?address='.$location.'&sensor=false';

    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $details_url);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    $response = json_decode(curl_exec($ch), true);

    if ($response['status'] != 'OK') {
        return null;
    }

    print_r($response);
}
share|improve this answer
    
Sure, I though, my question is no clear, the question is how to hook it before update / save memeber. I have not found that –  Carlos Jan 6 at 12:43

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.