Goal
Set up the Manage Invites Gravity Form so the app automatically shows it to a user as soon as they sign in with a pending staff invitation. The form shows the venue name, an Accept / Decline picker, and submits back to the chat-manager invite system.
This is unusual among MAM mobile forms: it is not opened by a tab bar button. The plugin pushes it as the app’s initial_form_to_display whenever the user has at least one pending invite.
Prerequisites
- A Gravity Form with the three slugs below.
- That form’s ID configured under Mobile App Manager → Geodirectory → Settings → GeoDirectory: Manage Invites.
local_app_gravity_formsclass available (provided bymam-gravity-forms-manager).- The user has unaccepted invitations stored in their
mam_staff_pendinguser meta (an array of listing IDs).
Form fields
mam_gd_form_manager::get_fields('listing_manage_invite'):
| ID | Title | Slug | populate_with_key | Type |
|---|---|---|---|---|
| 1 | Invitation Message | invite-message |
invite_message |
text (label, not input) |
| 2 | Invitation Selector | invite-status |
invite_status |
select (Accept Invitation / Decline Invitation) |
| 3 | Listing ID | postid |
postid |
hidden |
The Invitation Message field’s label is rewritten at runtime: a [Venue_Name] placeholder in the form’s label is replaced with the actual listing’s title before the form is sent. Configure your form so the label reads, e.g., "You have been invited to manage [Venue_Name]. What would you like to do?".
How the form is auto-displayed
mam_geodirectory_phone_data::inject_pending_invite_form() runs on mam_get_phone_data_before_send:
- Reads the user’s
mam_staff_pendinguser meta. - If the array is non-empty, fetches the configured form using
local_app_gravity_forms::get_data_for_app($form_id). - Walks the form’s fields:
- For the
invite-messagefield, replaces[Venue_Name]in the label with the title of the first pending listing. - For the
postidfield, setsvalueto the first pending listing ID.
- For the
- Pushes the resulting form into the global
$local_app_form_array. - Sets
data_array['has_initial_form_to_display'] = 'yes'andinitial_form_to_display = sizeof($local_app_form_array)(1-based index of the just-pushed entry). - Unsets
inapp_is_requiredso the IAP gate does not fire while the user is dealing with their invite.
The app honors the initial_form_to_display index and shows the form modally on launch.
Only the first pending listing is offered per app launch. After the user accepts or declines, the next launch offers the next pending invite.
Submission processing
This plugin does not register a dedicated handler for the Manage Invites form. The form’s submission lands on the chat-manager’s invite update path (typically mam_update_user_invitation_to_post_id); the chat manager records accepted or revoked based on the picked invite-status. Once accepted, the chat manager fires mam_gd_staff_member_accepted, which mam-geodirectory listens for to enrol the user in the listing’s chat group.
If you need bespoke processing on accept/decline (e.g., a welcome push), hook into mam_gd_staff_member_accepted (an action this plugin subscribes to but does not own — see Integration: Chat Manager).
Steps to enable
1. Build the Gravity Form
Three fields with the slugs above. The Invitation Selector should be a select with two options matching the values shown in the table.
2. Configure the label placeholder
Set the Invitation Message field’s label to include [Venue_Name] somewhere — that token is replaced with the listing title at runtime.
3. Wire the form ID
Settings → GeoDirectory: Manage Invites → pick your form. Save.
4. Verify
- From WordPress admin, add a test user as staff/manager on a listing via the Recipe: Manage staff and managers (admin) meta box.
- Confirm the user receives a
geodirectory-staff-invitationpush. - Open the app as that user. Verify the Manage Invites form appears modally on launch with the listing name interpolated into the label.
- Pick Accept Invitation and submit. Confirm the user joins the chat group, the IAP gate is suppressed for that launch, and on the next launch the form does not reappear.
Variations
- Show all pending invites at once. Not built in. The plugin shows only the first invite per launch.
- Different placeholder. Replace
[Venue_Name]with whatever string you prefer in your form label. Update the correspondingstr_replaceif you do (the plugin currently hardcodes[Venue_Name]). - Per-listing accept/decline notifications. Hook
mam_gd_staff_member_acceptedand dispatch your own messages.
Verification
This article was last verified against:
- Plugin:
mam-geodirectoryv2.1.5 - Source:
includes/mam_geodirectory_phone_data.php—inject_pending_invite_form() - Source:
includes/mam_gd_form_manager.php—get_fields('listing_manage_invite')
Re-verify whenever the placeholder token changes from [Venue_Name], the mam_staff_pending meta key changes, the inapp_is_required suppression is removed, or the chat-manager invite contract is renamed.
Related articles
- Plugin: mam-geodirectory
- Form: Add or remove staff and managers
- Recipe: Manage staff and managers (admin)
- Integration: Chat Manager
- GeoDirectory notification types
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 |
