Re: What does BP.org use to power the “current location” field in our profiles?
It uses the Google Maps API and a piece of xprofile data (“Current Location”). Here’s a pared down version of what’s used on the site:
`function bporg_insert_profile_info_column() {
global $bp; ?>
displayed_user->id ) ) : ?>
Location ยท <a href="”>Edit
var map = null;
var geocoder = null;
function initialize() {
if (GBrowserIsCompatible()) {
map = new GMap2(document.getElementById(“map_canvas”));
map.setCenter(new GLatLng(0, 0), 35);
geocoder = new GClientGeocoder();
}
}
function showAddress(address) {
if (geocoder) {
geocoder.getLatLng(
address,
function(point) {
if (point) {
map.setCenter(point, 11);
var marker = new GMarker(point);
map.addOverlay(marker);
map.addControl(new GSmallMapControl());
}
}
);
}
}
jQuery(document).ready( function() { initialize(); showAddress(”); } );
<?php }
add_action( ‘bp_before_member_activity_post_form’, ‘bporg_insert_profile_info_column’, 9 );
add_action( ‘bp_before_member_groups_content’, ‘bporg_insert_profile_info_column’, 9 );
add_action( ‘bp_before_followers_loop’, ‘bporg_insert_profile_info_column’, 9 );
add_action( ‘bp_before_following_loop’, ‘bporg_insert_profile_info_column’, 9 );
add_action( ‘bp_before_profile_content’, ‘bporg_insert_profile_info_column’, 9 );
add_action( ‘bp_before_member_messages’, ‘bporg_insert_profile_info_column’, 9 );`
[EDIT: Removed the API key and replaced with ‘KEYKEYKEY’. You’ll have to get your own from Google]