En cours

Modify Buddypress Profile Search Page to sort by distance.

I have a buddypress installation that I am using locations in the profile. I need the search results to display the distance between the zip code searched for (I have a database with all zipcodes) and the latitude and longitude of the matching search results. I have a script that calculates the distance between longitude and latitude coordinants and it works when I use sample data, but need help pulling in the zipcode and lon and lat from the search and assigning the long and lat from the profile I have this NEARLY DONE but need help finishing. Then I need the page to SORT ACCORDING TO THE CLOSEST SEARCH RESULT and paginate the remaining results.

I am looking for someone to do this in the next couple hours, please do not respond if you can't work on it right away and if you can't talk on SKYPE.

<?php

require_once("[url removed, login to view]");

// Lookup the longitude and latitude from the profile data

$latitude1 = <?php bp_member_profile_data( 'field=Latitude' );?>; // lat from the profile

$longitude1 = <?php bp_member_profile_data( 'field=Longitude' );?>; //lon from profile

// needs to search for long & latitude from the search box into wp_zip

$latitude2 = "SELECT Latitude FROM wp_zip WHERE wp_zip='$zip' LIMIT 1"; // wp_zip is the zipcode table with lat & lon

$longitude2 = "SELECT Longitude FROM wp_zip WHERE wp_zip='$zip' LIMIT 1"; // wp_zip is the zipcode table with lat & lon

// Create coordinates

$originCoord = new Coordinate($latitude1, $longitude1);

$relativeCoord = new Coordinate($latitude2, $longitude2);

$distCalc = new DistanceWizard();

// Perform calculation

$dist = $distCalc->CalculateDistance($originCoord, $relativeCoord, Measurement::MILES);

// Use result in a way of your choosing

//echo "Distance from Patient's Zipcode: " . $dist; echo " Miles"

?>

Compétences : AJAX, MySQL, PHP

Voir plus : buddypress search distance, buddypress distance search, buddypress distance, distance search buddypress, buddypress profile search, buddypress zip code search, search profile distance buddypress, profile php code, buddypress sort distance, buddypress search zip code, buddypress profile sort, sample profile, profile sample, zip code search, search zip code, profile database, php buddypress, modify code, measurement, longitude, data pulling, distance zip code, search results php, sample php page, php search box

Concernant l'employeur :
( 11 commentaires ) Rochester, United States

N° du projet : #1019888

Décerné à :

godka

Hello, I can help.

100 $ USD en 2 jours
(22 Commentaires)
5.6