=== Rock Bands For Hire ===
Contributors: mattfaler
Tags: bands, musicians, directory, geolocation, booking, gigs
Requires at least: 6.2
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 1.1.1
License: GPL-2.0-or-later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

A bands-for-hire directory. Bands list themselves; visitors find bands near them by browser geolocation, sorted by distance, with a map, booking inquiries and upcoming live shows ("Come see us live").

== Description ==

* **Band listings** (`gbfh_band`): name, genres (taxonomy `gbfh_genre`), city/state/zip, travel radius, photo gallery, rates (from/to, per hour or per event, notes), bio, YouTube/Spotify/SoundCloud/Vimeo embeds, phone, booking email (never shown publicly), website and socials.
* **Automatic map placement**: the city/state/zip is geocoded with OpenStreetMap Nominatim when saved (proper User-Agent, contact email, max 1 request/second, 30-day cache). Admins and owners can override latitude/longitude.
* **Find Bands** (`[gbfh_directory]`): asks for the visitor's location once, remembers it in the browser (localStorage) so later visits never re-prompt, names the city ("Bands near St. Petersburg, FL") through a cached, rate-limited server proxy, and lists bands nearest first with the distance. Radius (10/25/50/100), genre filter, "only bands that travel to me", and a Leaflet map view. If location is denied, visitors type a city or zip (no IP lookups). `?near=Tampa` links also work without JavaScript.
* **Band owner accounts**: front-end registration and login, role `gbfh_band_owner`, dashboard (`[gbfh_dashboard]`) to add/edit bands, manage photos, mark available/unavailable and read booking inquiries. Band owners are kept out of wp-admin.
* **Booking inquiries**: form on every band page (name, email, phone, event date, event type, venue city, budget, message). Saved as private `gbfh_inquiry` posts, emailed to the band with Reply-To set to the visitor, optional BCC to the admin. Nonce, honeypot, time trap and per-visitor rate limit.
* **Text alerts (optional)**: when "Text the band" is enabled and Raatt's Text Reminder Plugin is active (`rtr_send` exists), fires `do_action( 'rtr_send', $band_phone, $message, 'gbfh_inquiry' )`. Off by default.
* **Moderation**: new and edited listings go to Pending; admin gets an email; Approve / Reject (with reason) row actions; owners are emailed either way. List columns: City, Genre, Listing status, Inquiries.
* **Upcoming live shows ("Come see us live")**: band owners add one or more gigs from the dashboard's *Live shows* tab: date, start time, venue, street address, city/state/zip, optional ticket/event link and notes. They can edit and delete them. Shows are stored as `gbfh_show` posts whose parent is the band, and each show's city is geocoded with the same cached, rate-limited Nominatim helper as bands.
* **Band profile "Upcoming Shows"**: future shows only, soonest first. A show disappears by itself 4 hours after its start time (filter `gbfh_show_duration`). Band cards in the directory show the next gig.
* **Live Shows list** (`[gbfh_shows]`): upcoming shows from all approved bands, with filters for date (All upcoming / Today / This weekend / Next 30 days), genre, and "near me" radius. It re-uses the directory's remembered location (no second permission prompt), with a "Near me" button and a city/zip box. `?gs_when=weekend&gs_genre=ID&gs_near=Tampa&gs_radius=25` links work without JavaScript.
* **Playing tonight near you** (`[gbfh_shows when="tonight" limit="6"]`): compact list for a home page. "Tonight" runs until 4am. Attributes: `when` (upcoming|today|weekend|30days|tonight), `limit` (1-50), `genre` (slug), `radius`, `filters` (yes|no) and `title`.
* **Show moderation**: shows only appear while the band's listing is approved (published) and marked available. Optionally (Settings → "Live shows"), new and edited shows from band owners also wait for approval under Rock Bands For Hire → Live Shows.
* **Pages created on activation**: Find Bands, List Your Band, Band Login, Live Shows.

== REST API ==

* `GET /wp-json/gbfh/v1/bands?lat=&lng=&radius=&genre=&covers=&page=&per_page=`
* `GET /wp-json/gbfh/v1/reverse?lat=&lng=` (cached ~1 km grid)
* `GET /wp-json/gbfh/v1/geocode?q=`
* `GET /wp-json/gbfh/v1/shows?when=&lat=&lng=&radius=&genre=&page=&per_page=` (radius 0 = anywhere)

Distance search uses an indexed `{prefix}gbfh_geo` table: a latitude/longitude bounding-box prefilter, then the haversine formula in SQL. Show search first narrows to the date window in SQL, then applies the same haversine formula (`gbfh_distance()`) to the shows' coordinates.

== Templates ==

Copy any file from `templates/` into `yourtheme/grok-bands-for-hire/` to override it (directory.php, band-card.php, single-band.php, inquiry-form.php, shows.php, show-card.php, dashboard.php, dashboard/*.php, account/login-register.php). On block themes the plugin registers a clean "Single Band" template; a theme file `single-gbfh_band.html` takes priority.

== Look & feel ==

The stylesheet uses the active block theme's color/spacing presets, so it matches Twenty Twenty-Five out of the box (yellow accent buttons, its fonts). Suggested setup on Twenty Twenty-Five:

1. Settings → Reading → set "Find Bands" as the homepage.
2. Appearance → Editor → Navigation: Find Bands, Live Shows, List Your Band, Band Login.
3. Optionally pick the "Evening" or "Noon" style variation for a music-venue feel.

== Privacy ==

Visitor coordinates are rounded (~1 km) before reverse geocoding and are only stored in the visitor's own browser. Rate limiting uses a salted hash of the IP, kept for at most an hour. Map tiles load from tile.openstreetmap.org; Leaflet itself is bundled (BSD-2-Clause, see assets/vendor/leaflet/LICENSE.txt).

== Uninstall ==

Deleting the plugin keeps all data unless Settings → "Delete data" is ticked, in which case bands, photos, live shows, inquiries, genres, pages, settings, the geo table and the band owner role are removed (owners become subscribers).

== Changelog ==

= 1.1.1 =
* Renamed to Rock Bands For Hire (plugin name, admin menu, headings, emails). Slug, shortcodes, data and settings are unchanged, so existing sites keep working.

= 1.1.0 =
* New: upcoming live shows ("Come see us live"). Bands add, edit and delete gigs from the dashboard's Live shows tab.
* New: an "Upcoming Shows" section on band profiles, plus the next gig on directory cards.
* New: the `[gbfh_shows]` shortcode with date range, genre and near-me radius filters, and a `when="tonight"` "Playing tonight near you" mode.
* New: the `GET /gbfh/v1/shows` REST route, a "Live Shows" page created on activation, and optional show moderation.

= 1.0.0 =
* First release.
