Goal
Configure a Gravity Form that the app shows in its left-menu (drawer) area, with a single field that the plugin populates with the current staff member’s QR code URL. Customers scan the QR with their device camera to download the app or jump directly to the staff member’s listing.
The form is unusual: it has only one field, which is hidden in the form definition, and the plugin overwrites the field’s value (and adds aspect/can_copy_to_clipboard flags) at runtime so the app can render it as a tappable QR image.
Prerequisites
- A Gravity Form with one hidden field with slug
qrcode-field. - That form’s ID configured under Mobile App Manager → Geodirectory → Settings → GeoDirectory: Add QR Code to DL the App.
- The user is a venue staff member with at least one entry in their
mam_staff_locationsuser meta (an array of listing IDs). - Either:
branch_app_idoption set, in which case the plugin generates a Branch deep link viamam_universal_link_get_branch_linkand stores it inmam_site_qrcode_{listing_id}option; ORmam_site_qrcodeoption set as a fallback site-wide QR code.
Form fields
mam_gd_form_manager::get_fields('add_qrcode_to_dl_app'):
| ID | Title | Slug | populate_with_key | Type |
|---|---|---|---|---|
| 1 | QR Code Field | qrcode-field |
qrcode |
hidden |
add_field_features() sets special_handling = '48' on this field, which the Gravity Forms manager interprets as “render as a QR-code image preview on the app side.”
How the form is populated
mam_geodirectory_phone_data::inject_qr_code_into_form() runs on mam_get_phone_data_before_send:
- Reads the configured form ID (
mam_geodirectory_add_qrcode_to_dl_appoption) and field ID (mam_geodirectory_add_qrcode_to_dl_app_qrcode-fieldoption). - Walks
data_array['left_menu']looking for the entry with matchingvc_type=formandformid={configured ID}. - Within that entry’s
data.fields, finds the field with the matching ID and sets:value= the QR code URL (fromget_qr_code_url()).aspect='1'.can_copy_to_clipboard='yes'.
- If the universal-link feature is disabled (
mam_universal_link_enabledfilter returns false), the plugin removes the entry from the left menu entirely — i.e., the QR feature is hidden when universal links aren’t set up.
get_qr_code_url():
- Returns
mam_site_qrcode(a site-wide fallback) when the user has nomam_staff_locations. - For each staff location, builds (or retrieves cached) a Branch link via
mam_universal_link_get_branch_linkand stores it undermam_site_qrcode_{listing_id}. Currently uses$locations[0]only. - Falls back to an empty string if Branch is not configured.
Steps to enable
1. Build the Gravity Form
A single hidden field with the slug qrcode-field. No other fields required.
2. Wire the form ID
Settings → GeoDirectory: Add QR Code to DL the App → pick your form. Save.
3. Add the form to the left menu
In your app’s left menu / drawer configuration, add a “form” entry pointing at the same Gravity Form. The plugin will find it by formid and overwrite its single field’s value at request time.
4. Configure Branch (recommended)
Set branch_app_id option. The plugin’s apply_filters('mam_universal_link_get_branch_link', ...) call hands data (title, image URL, venue code) to mam-main’s universal-link feature, which returns a Branch deep link. The link is cached per listing.
5. Verify
- Sign in as a staff member with an entry in
mam_staff_locations. - Open the app. Open the left menu. The QR Code form entry should be there.
- Tap the entry. The QR code image should render. Scanning it with another device should open the app to the staff member’s venue.
- For users without
mam_staff_locations, the form entry falls back to the site-widemam_site_qrcode.
Variations
- Suppress the form when universal links are off. This is the default behavior — turn
mam_universal_link_enabledto false to hide the form. Useful when the app is in a pre-Branch state. - Use a different cache key. The plugin caches per listing ID (
mam_site_qrcode_{listing_id}). To force a refresh, delete the option. - Show all locations. The plugin only uses
$locations[0]. To show one QR per location, override the form data downstream — e.g., a custommam_get_phone_data_before_sendsubscriber at lower priority.
Verification
This article was last verified against:
- Plugin:
mam-geodirectoryv2.1.5 - Source:
includes/mam_geodirectory_phone_data.php—inject_qr_code_into_form(),get_qr_code_url() - Source:
includes/mam_gd_form_manager.php—get_fields('add_qrcode_to_dl_app')
Re-verify whenever the form’s special-handling code (48) changes meaning in the Gravity Forms manager, the mam_universal_link_* filter contract changes, the mam_staff_locations meta key is renamed, or the cache key format (mam_site_qrcode_{listing_id}) changes.
Related articles
- Plugin: mam-geodirectory
- Recipe: Configure the GeoDirectory settings page
- Form: Manage staff invitation
- Form: Add or remove staff and managers
Metadata
| Field | Value |
|---|---|
| Article type | Recipe (Admin) |
| Plugin slug | mam-geodirectory |
| Applies to plugin version | 2.1.5+ |
| Category | Building Your App |
| Audience | WordPress admin |
| Estimated time | 5 minutes |
| Last verified | 2026-05-01 |
