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 ) ) : ?>
<?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]
Thanks Boone!
That works like a charm with a new API key.
Any thoughts on how to incorporate this geotagging into the activity filters? I need to find a way to filter activity by proximity.
For example, all activity by members within 50 miles of you.
Thanks for the note about the API key. I removed it from the original post.
The kind of sorting you’re talking about is possible but is quite a bit trickier. I have successfully used https://wordpress.org/extend/plugins/buddypress-geo/ is a starting point for that kind of filtering, but the repo version of the plugin is broken, and I’ve modified it fairly heavily to make it work for my projects. One day I hope to release a cleaned-up and improved version of BP Geo.
The basic gist is that you need to (a) use Google’s geocoding to turn location info into lat/long which you then store, and (b) use some fancy math (nicely defined in bp-geo) to do the proximity filtering.
Yeah…I was looking at that plugin and a couple of others out there that just don’t seem baked enough.
My plan is to have visitors to my site enter a location and see activity from all members and groups near it as a default stream. I don’t need a bunch of fancy extras, just a proximity filter for members’ activities.
I’d be happy to contribute or help somehow if you could get a new BP GEO to do this.
Thanks!