User Locations - Hooks

The view and controls of the map may be customized with hooks.

Map options:

  • Use hook um_user_locations_map_args_init to customize the map on the Members page.
  • Use hook um_user_locations_map_field_args_init to customize the map on the Profile page.

Markers and clustering:

  • Use hook um_user_locations_marker_data to change the map marker.
  • Use hook um_user_locations_marker_clustering_options to change clustering options.
  • Use hook um_member_directory_disable_clustering to disable clustering.

Location address:

  • Use hook um_user_location_after_location_field_set_by_autocomplete to change the location address after autocomplete.
  • Use hook um_user_location_formatted_address_set_by_geocode to change the location address after geocode.

See code examples below. You can add code snippets (without the opening <?php tag) to the functions.php file in the active theme directory.

Example 01 #

  • Change the map marker title.
  • Replace the map marker image.

Example 02 #

  • Set default zoom.
  • Disable the Zoom control.
  • Disable zooming on the map using a mouse scroll wheel.

Example 03 #

  • Set default center and restrict the map bounds.
  • Set default zoom and restrict the map to minimum and maximum zoom.

Example 04 #

  • Disable clustering.

Example 05 #

  • Use Map ID.

Example 06 #

  • Replace the full address with the city name on autocomplete.
  • Replace the full address with the city name on geocode.

Related Maps JavaScript API documentation: