What it does
When mam-special-offers is also active, mam-geodirectory provides three integrations:
- Coordinates and radius — exposes a GD listing’s latitude, longitude, and the configured radius override to the special-offers nearby-feed.
- Per-package deal cap — translates the package’s
no_of_deals_includedfield into the per-listing offer cap used by the Edit Deals tab bar button. - Tab bar visibility — hides the Edit Deals button entirely from non-owner/staff/manager viewers, before the special-offers plugin even tries to build it.
Coordinates and radius
mam_gd_special_offer_settings registers three filters owned by mam-special-offers:
| Filter | Returns |
|---|---|
mam_specials_get_post_lat |
geodir_get_post_meta($post_id, 'latitude', true) |
mam_specials_get_post_lon |
geodir_get_post_meta($post_id, 'longitude', true) |
mam_specials_get_post_radius |
The value of the mam_gd_standard_radius_override option (numeric and > 0), else the default radius the special-offers plugin passed in. |
The radius hook applies globally — every nearby-offers query uses the same override.
The lat/lon hooks resolve per-offer when the offer’s parent is a GeoDirectory post. (For non-GD parents, special-offers falls back to its own resolution path.)
Per-package deal cap
mam_gd_tab_bar_buttons::mam_special_offers_deals_allowed($deals_allowed, $data_array) is registered on the mam_special_offers_deals_allowed filter (owned by mam-special-offers). It:
- Resolves the user’s role on the listing.
- If the user is owner / admin / staff, looks up the listing’s package via
geodir_get_post_meta($id, 'package_id', true). - If the package has
no_of_deals_includedset and non-empty, returns that count as the cap. - Otherwise returns the upstream default unchanged.
Non-owner/staff users get the upstream default — they cannot edit deals anyway, so the cap is irrelevant for them.
Tab bar hard-skip
mam_gd_tab_bar_buttons::mam_special_offers_hard_skip_tab_bar_button($skip, $tab_bar, $data_array) is registered on mam_special_offers_hard_skip_tab_bar_button (owned by mam-special-offers). It:
- Resolves the user’s role on the listing.
- If the user is owner / manager / admin / staff, returns the upstream skip flag unchanged (typically
false— let the upstream chain decide). - Otherwise returns
true— hard-skip; the Edit Deals button never renders.
This runs before the special-offers plugin builds the button, so it saves a round-trip on the upstream chain.
Steps to set up
- Install and activate
mam-special-offers. - Set
mam_gd_standard_radius_override(under Mobile App Manager → Geodirectory → Settings → Radius distance) if you want to override the special-offers default of 5 miles. Setting it to0or empty leaves the upstream default in place. - Set
no_of_deals_includedon each pricing package — see Recipe: Pricing package fields. - Verify the Edit Deals button appears for owners (when below the cap) and disappears for everyone else.
Notes and gotchas
- Radius override is global. Setting
mam_gd_standard_radius_overrideaffects every special offer in the system, not just GD-parent offers. If you only want a wider radius for GD parents specifically, overridemam_specials_get_post_radiusin your own code with a per-call decision. - Pricing package metadata is read on every tab bar build. Caching is the responsibility of the upstream caller; this plugin does not cache
geodir_pricing_get_metaresults. - Empty string vs zero. The cap is only applied when
no_of_deals_included[0]is!== ''. A package with the field saved as0returns0(i.e., no deals allowed).
Verification
This article was last verified against:
- Plugin:
mam-geodirectoryv2.1.5 - Plugin:
mam-special-offersv2.1 - Source:
includes/mam_gd_special_offer_settings.php - Source:
includes/mam_gd_tab_bar_buttons.php—mam_special_offers_deals_allowed,mam_special_offers_hard_skip_tab_bar_button
Re-verify whenever the special-offers filter signatures change, the no_of_deals_included package meta key is renamed, or the special-offers plugin changes its default radius/lat/lon resolution.
Related articles
- Plugin: mam-geodirectory
- Recipe: Pricing package fields
- Listing tab bar buttons
Metadata
| Field | Value |
|---|---|
| Article type | Plugin Overview |
| Plugin slug | mam-geodirectory |
| Applies to plugin version | 2.1.5+ |
| Category | Plugin Reference |
| Audience | PHP developer |
| Last verified | 2026-05-01 |
