WP Manifestindependent plugin directory
manifest / users / osm-members-map

OSM Members Map

WordPress plugin to plot BP member's on a Open Street Map

by Ricardo Ruiz Freire · github.com/globalinnovationgathering/osm-members-map

0stars
0forks

Install

No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:

wp plugin install https://github.com/globalinnovationgathering/osm-members-map/archive/refs/heads/main.zip

Readme

OSM Members Map

A WordPress plugin that shows your BuddyPress members on an interactive map — built entirely on OpenStreetMap data via Leaflet, with no Google Maps and no API key required for the default map style.

It was built as a drop-in, independent replacement, using its own profile field type and its own storage — so it never depends on either of those plugins.

Features

  • Custom "OSM Location" profile field type — members type an address on their BuddyPress profile and pick a suggestion from a live autocomplete list, powered by Photon (a free, OpenStreetMap-based geocoder — no API key). Coordinates are geocoded and saved automatically when the field is saved.
  • [osmmembersmap] shortcode — renders a Leaflet map plotting every member whose location field is set to Public visibility, with marker clustering for members close together.
  • Choice of 8 map tile styles — Standard, CyclOSM, Cycle Map, Transport Map, Tracestrack Topo, Humanitarian, Shortbread, and MapTiler OMT (the last four are vector styles rendered via MapLibre GL). Some styles need a free API key from their provider; the settings page tells you which and links to sign-up.
  • Search box (optional) — lets visitors search any word across members' public profile fields (name, bio, organisation, etc.); matching members stay pinned on the map, everyone else is hidden until Clear is pressed.
  • Profile lightbox (optional) — clicking a pin always shows a small popup card first; clicking the member's name inside that popup can open their full profile in a lightbox panel over the map instead of navigating away.
  • Theme-aware popup styling — the small popup card's fonts, text color, and link color are read from the active theme at runtime, so it matches the site instead of looking like a generic Leaflet popup.
  • One-time migration tool — for sites moving off BP xProfile Location, a Settings → OSM Map: Migrate screen copies existing saved locations/geocodes over to the new field, with a Photon-based fallback geocode for members who don't already have one saved.
  • No Google Maps, no vendor lock-in — every tile source and the geocoder are free, OSM-based services; self-hosted alternatives (a private Photon instance, a different MapLibre style) are configurable from the settings page.

Requirements

  • WordPress 6.0+
  • PHP 7.4+
  • BuddyPress with the Extended Profiles (xProfile) component active

Installation

  1. Download the latest release zip (or clone this repo into wp-content/plugins/).
  2. In wp-admin, go to Plugins → Add New → Upload Plugin and upload the zip (or activate it directly if you cloned it into wp-content/plugins/).
  3. Activate OSM Members Map.

Quick start

  1. Users → Profile Fields → Add New Field → set Type = OSM Location. Set its default visibility as you like — only members with Public visibility on this field show on the map.
  2. Settings → OSM Members Map → select that field as the "Location field". Adjust the default map center/zoom and tile layer if needed.
  3. Drop [osmmembersmap] on any page or post.
  4. Ask members to (re)save their profile location field, picking an address from the autocomplete dropdown, so it gets geocoded.

If you're migrating from BP xProfile Location, use the Settings → OSM Map: Migrate tool instead of step 4 — it copies existing member locations (and geocodes) across automatically.

Settings

Every option lives under Settings → OSM Members Map, and each field on that page has its own inline explanation. Highlights:

Setting What it does
Location field Which "OSM Location" profile field the map reads addresses from.
Default map center / zoom The view shown before any members are plotted.
Map layer Which of the 8 tile styles renders the map.
API key fields Only needed for tile layers that require one (Cycle Map, Transport Map, Tracestrack Topo, MapTiler OMT) — each field links to that provider's free sign-up.
Address autocomplete API The Photon endpoint used for the profile field's address suggestions; can point to a self-hosted instance.
Cluster markers Groups nearby members into a single numbered circle at lower zoom levels.
Search box Adds a search field + Clear button under the map.
Profile lightbox Opens a member's profile in an overlay panel instead of navigating away.

How it works

  • includes/class-field-type-osm-location.php — registers the osm_location BuddyPress xProfile field type, with Photon-powered address autocomplete (assets/js/admin-field-osm-location.js).
  • includes/class-geo-storage.php — geocodes and stores each member's coordinates in usermeta whenever their location field is saved.
  • includes/class-rest-api.php — exposes /wp-json/gig-osm-map/v1/locations (all map-eligible members) and /wp-json/gig-osm-map/v1/search?q= (server-side search across public profile fields).
  • includes/class-shortcode.php — registers and enqueues Leaflet / Leaflet.markercluster / MapLibre GL as needed, and renders the [osmmembersmap] markup.
  • includes/class-tile-layers.php — the registry of the 8 tile-layer presets and the logic that resolves the active one (including missing-API-key detection).
  • includes/class-admin-settings.php — the Settings → OSM Members Map screen.
  • includes/class-migration.php — the one-time BP xProfile Location → OSM Location migration tool.
  • assets/js/members-map.js — the frontend: builds the Leaflet map, renders markers, and wires up search / lightbox / theme-aware popup styling when those settings are enabled.

License

GPLv2 or later.

Author

Ricardo Ruiz Freire

Read the full README on GitHub →