Integration: Special Offers

What it does

When mam-special-offers is also active, mam-geodirectory provides three integrations:

  1. Coordinates and radius — exposes a GD listing’s latitude, longitude, and the configured radius override to the special-offers nearby-feed.
  2. Per-package deal cap — translates the package’s no_of_deals_included field into the per-listing offer cap used by the Edit Deals tab bar button.
  3. 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:

  1. Resolves the user’s role on the listing.
  2. If the user is owner / admin / staff, looks up the listing’s package via geodir_get_post_meta($id, 'package_id', true).
  3. If the package has no_of_deals_included set and non-empty, returns that count as the cap.
  4. 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:

  1. Resolves the user’s role on the listing.
  2. If the user is owner / manager / admin / staff, returns the upstream skip flag unchanged (typically false — let the upstream chain decide).
  3. 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

  1. Install and activate mam-special-offers.
  2. 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 to 0 or empty leaves the upstream default in place.
  3. Set no_of_deals_included on each pricing package — see Recipe: Pricing package fields.
  4. 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_override affects every special offer in the system, not just GD-parent offers. If you only want a wider radius for GD parents specifically, override mam_specials_get_post_radius in 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_meta results.
  • Empty string vs zero. The cap is only applied when no_of_deals_included[0] is !== ''. A package with the field saved as 0 returns 0 (i.e., no deals allowed).

Verification

This article was last verified against:

  • Plugin: mam-geodirectory v2.1.5
  • Plugin: mam-special-offers v2.1
  • Source: includes/mam_gd_special_offer_settings.php
  • Source: includes/mam_gd_tab_bar_buttons.phpmam_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.


  • 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
Contents

    Need Support?

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