The location_gmap_find_address submodule contains a check to see if it should include the "Find address on map" button, but this check excludes the user profile form. Since location fields can now be added to users, this line needs amendment.
I changed line 7 of location_gmap_find_address.module from
if (isset($form['#node_edit_form']) && $form['#node_edit_form'] && variable_get('location_usegmap', 0)) {
to
if ($form['#form_id'] == 'user_profile_form' || (isset($form['#node_edit_form']) && $form['#node_edit_form']) && variable_get('location_usegmap', 0)) {
This made the button appear. I don't know if this is the best way of addressing this issue but as I couldn't find it referred to anywhere I thought I would post it here and see if anyone can say if this is a problem or should be made into a patch.
Comments
Comment #1
alessandro rancati commentedDid not work for me. When I replace the code I get the following errors:
If I replace the
$form['#form_id'] == 'user_profile_form'with
$form['#form_id'] == 'user-profile-form'The errors disappear but the button is still missing.
I am running drupal 7.26 with gmap 7.x-2.8 and Location 7.x-3.2-beta2
Comment #2
donutdan4114 commentedThis issue isn't just for the user profile form.
The button won't show up anywhere else, aside from the node edit form.
Doesn't work with Inline Entity Form module.
Comment #3
DrCord commentedI was able to make this work for a user profile2 location field. It required some custom code, but really this should be expanded to work with all profile types and then added to this module. This code is setup to work with a profile2 profile type called "personal_information", change that to your profile type machine name.
New location_gmap_find_address.module file codelocation_gmap_find_address_profile.js: New additional JavaScript file that works with the "personal_information" profile2 profile type, change this to work with your profile type machine name.Comment #4
saranya mohan commentedBut this button is appearing at the top of a profile form. it just appear on top of the location field.
Comment #5
saranya mohan commenteduser can enter only one location find address button appears correctly. but it has add multiple location this code is not wroking properly
Comment #6
giuvax commentedAfter three years ths button is still showing just on nodes. Is anybody working at this?