Form: Manage staff invitation

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_forms class available (provided by mam-gravity-forms-manager).
  • The user has unaccepted invitations stored in their mam_staff_pending user 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:

  1. Reads the user’s mam_staff_pending user meta.
  2. If the array is non-empty, fetches the configured form using local_app_gravity_forms::get_data_for_app($form_id).
  3. Walks the form’s fields:
    • For the invite-message field, replaces [Venue_Name] in the label with the title of the first pending listing.
    • For the postid field, sets value to the first pending listing ID.
  4. Pushes the resulting form into the global $local_app_form_array.
  5. Sets data_array['has_initial_form_to_display'] = 'yes' and initial_form_to_display = sizeof($local_app_form_array) (1-based index of the just-pushed entry).
  6. Unsets inapp_is_required so 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-invitation push.
  • 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 corresponding str_replace if you do (the plugin currently hardcodes [Venue_Name]).
  • Per-listing accept/decline notifications. Hook mam_gd_staff_member_accepted and dispatch your own messages.

Verification

This article was last verified against:

  • Plugin: mam-geodirectory v2.1.5
  • Source: includes/mam_geodirectory_phone_data.phpinject_pending_invite_form()
  • Source: includes/mam_gd_form_manager.phpget_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.


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

    Need Support?

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