Business Directory forms

Summary

mam-business-directory registers mobile forms through the MAM Gravity Forms manager. The Add/Edit Listing form is generated dynamically from the wpbdp field schema (wpbdp_get_form_fields()); the rest are static forms.

Form Form key Handler Purpose
Add/Edit Listing wpbdp_listing (the post type) mam_bd_add_edit_listing_form_handler::save_form Create/edit a listing
Approve Listing bd_approve_listing mam_bd_approve_listing::approve_listing Admin approve/reject a pending listing
Add Users (staff/managers) bd_add_users mam_bd_add_edit_staff::add_edit_staff Invite/reinvite/revoke crew
Send Notification bd_send_notification mam_bd_send_notification::send_notification Push to listing followers
Approve Claim bd_approve_claim mam_bd_approve_claim::approve_claim Admin approve/reject a claim

Form keys are bd_-namespaced on purpose. The mam_generated_forms registry is shared suite-wide; GeoDirectory owns the bare keys (approve_listing, add_users, …). Namespacing prevents a bare key from wiring both plugins’ handlers onto one form.


Add/Edit Listing

Generated from the site’s wpbdp form fields, honoring per-field visibility, the instructions text (mam_bd_instructions), and the one-category-only toggle. On save the handler:

  • Checks edit rights + a rate limiter, then writes via wpbdp_save_listing() (fields, categories, images, default free plan).
  • Handles image deletes (only the literal [] marker clears the gallery — empty/malformed submissions preserve existing images).
  • Geocodes the address (progressive fallback) and writes flat lat/lon plus the Google Maps module’s geolocation object with a valid field_hash; derived _mam_bd_city/_mam_bd_region are written from the geocode components.
  • Derives post status from bd-add-in-draft on every non-admin save (edits re-enter moderation); admins always publish.

Approve Listing

Approve → publish the listing; reject → delete it and notify. The handler post-type-guards so it only acts on wpbdp_listing.

Operational note

mam_generated_forms is populated the first time the admin Forms settings page runs. Visit App Setup → Forms once after deploy, then the form handlers wire on the next load.


  • Plugin: mam-business-directory
  • Listing tab bar buttons
  • Recipe: Manage staff and managers
  • Business Directory notification types

Metadata

Field Value
Article type Forms Reference
Plugin slug mam-business-directory
Category App Content
Audience WordPress admin
Was this article helpful?
Contents

    Need Support?

    Can't find the answer you're looking for? Don't worry we're here to help!