Ask your WordPress questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

Geo Mashup location form embedded into Buddypress isn't showing WordPress

  • SOLVED

I need users to be able to add their location to the map on their forward facing Buddypress profile page via the Geo Mashup form. The idea is that when a user signs up for the site, they can add their physical location which is then displayed on the global map on another page.

The template tag: <?php echo GeoMashupUserUIManager::get_instance()->print_form(); ?> prints the form on the Buddypress profile page, but not the map itself.

The error received is "Loading Google map. Check Geo Mashup options if the map fails to load." - I have read the documentation and adjusted settings, but the map does not show up. Because the map won't show up, users are unable to add their actual location.

I've spent a good amount of time working through Google and researching the different methods, but I'm coming up blank.

Help?!

Answers (1)

2016-03-28

Dylan Kuhn answers:

In addition to printing the form, you'll need to make sure the scripts that power it get enqueued. This code could go in your theme functions.php file or other location for site-specific code:


add_filter( 'geo_mashup_load_location_editor', 'filter_geo_mashup_load_location_editor' );
/**
* Load location editor on the BuddyPress user profiles
*/
function filter_geo_mashup_load_location_editor( $load_flag ) {
if ( bp_is_user_profile() ) {
return true;
}

return $load_flag;
}


Jason Britton comments:

So before I added this snippet, the form was showing with the "Add Location" button. With your snippet, that no longer shows.

We're getting there though!

J


Jason Britton comments:

More info:

I've attached a screencap of what it looked like before your enqueued script. After the script has been enqueued, the layout inherits styling from your plugin, but the "save" button isn't there. There are no errors, but there is a warning that there's no API key from Google. In the options I didn't include an API key because it's not necessary.

I appreciate your help on this! Thanks for making and maintaining a great plugin!

(Also, is it possible that the enqueuing script piece was in the documentation but I didn't see it? I feel like I would have come across that in the hours of searching I've done.)