What it does
mam-main is the kernel of the MAM Suite — Tiny Screen Labs’ mobile-app-management platform. Every enrolled customer site runs WordPress with mam-main plus a portfolio of sibling plugins (mam-contact-form, mam-geodirectory, mam-chat-manager, mam-special-offers, etc.). The iOS and Android apps talk to the WordPress site via a single AJAX endpoint that returns a JSON payload describing every screen, button, and content element.
mam-main owns:
- The mobile API surface. A single AJAX action (
local_app_get_phone_data) dispatches a 4-phaseMAM_Phone_Data_Pipelinethat builds the JSON payload returned to the app. ~70 sibling-plugin subscribers extend it viamam_get_phone_data_before_send. - The app-settings registry. Themes, layouts, buttons, tabs, content sections, and image assets — all persisted, all admin-editable, all accessed through the
mam_app_settings_get_settingfilter cascade with 100+ call sites. - The notification dispatcher. A single
MAM_Notification_Dispatcherroutesmam_notification_send_messageactions across email, SMS, and push channels, queueing or sending immediately based on volume. - Push credentials and device-token storage. APNs (HTTP/2 + VoIP) and FCM v1 senders, plus a token registry per user.
- User roles, login, and registration. Email + password, magic link, social, phone-code; profile fields rendered as Gravity Forms.
- Gravity Forms integration. Caches form definitions, transforms them into a mobile-app-renderable shape, processes app-side submissions, fires per-form-id hooks for sibling plugins.
- Cron infrastructure. A FastCron-driven AJAX endpoint plus the
mam_cron_managerfilter that sibling plugins subscribe to register their own scheduled tasks. - The publish pipeline. Submits iOS and Android builds to the WPMAM publishing service via Fastlane.
- Setup wizard and enrollment. First-launch onboarding, account-code allocation, plugin entitlement checks.
- 21 content classes — the building blocks (Login, Map, Web URL, Favorites, etc.) that customer admins compose into screens via the no-code builder.
Sibling plugins extend mam-main exclusively through filters and actions. mam-main never imports their classes; they hook into its pipelines.
Where it sits in the platform
┌───────────────────────────────────────────────┐
│ Mobile app (iOS + Android) │
└───────────────────────────────────────────────┘
│
AJAX │ local_app_get_phone_data
▼
┌───────────────────────────────────────────────┐
│ mam-main │
│ │
│ • MAM_Phone_Data_Pipeline (4 phases) │
│ • mam_get_phone_data_before_send (~70 subs) │
│ • MAM_Notification_Dispatcher │
│ • App settings registry │
│ • Forms manager (Gravity Forms) │
│ • Push manager (APNs + FCM) │
│ • Cron (FastCron) │
│ • 21 content classes │
└───────────────────────────────────────────────┘
│
┌──────────────┼──────────────┬──────────────┐
▼ ▼ ▼ ▼
┌────────────────┐ ┌────────────┐ ┌────────────┐ ┌────────────┐
│ mam-geo- │ │ mam-chat- │ │ mam- │ │ mam- │
│ directory │ │ manager │ │ special- │ │ contact- │
│ │ │ │ │ offers │ │ form │
└────────────────┘ └────────────┘ └────────────┘ └────────────┘
│ │ │ │
└──────────────┴──────────────┴──────────────┘
(and 30+ more — geofilters, IAP, reviews,
gravity-forms-manager, mam-suite-hold, mam-use-case)
mam-main is roughly 5x the size of the largest sibling plugin (~145 PHP files across 22 subsystems vs. mam-geodirectory’s ~23 files).
Subsystems
| Subsystem | Role |
|---|---|
app-connect |
Legacy AJAX wrapper; thin facade over phone-data |
phone-data |
MAM_Phone_Data_Pipeline + MAM_Phone_Data_Context — canonical mobile-API pipeline |
app-settings |
Themes, layouts, buttons, tabs, content sections, image assets, push-credential admin UI |
content-classes |
21 content-type handlers — Login, Map, Web URL, Favorites, etc. |
content-class-elements |
Reusable UI section builders (add-to-cart, featured-image, social-media, etc.) |
forms-manager |
Gravity Forms integration: cache, transform, submit, route notifications |
notifications-manager |
MAM_Notification_Dispatcher + email/SMS/push channel senders + admin UI |
push-notification-manager |
APNs (HTTP/2 + VoIP) and FCM v1 senders, JWT signing, token registry |
mail-cron-manager |
Email + SMS + PN queue processor, batch cron handler |
setcron-manager |
FastCron-driven custom WP cron scheduling; mam_cron_manager filter |
user-roles |
Auth, registration, login flow, profile, phone-code validation |
setup-wizard |
First-launch onboarding, site enrollment, AI assistant |
publish-app |
iOS/Android build submission to WPMAM publishing pipeline |
plugin-update-manager |
Software entitlements, update checks, plugin upgrade orchestration |
account-code |
MAM_Account_Code_Manager — owner of the local-app-account_code option |
migrations |
MAM_Migration_Tasks — option/table rename framework with backward-compat aliasing |
repositories |
7 DB repositories (one per owned table) |
request-context |
MAM_Current_Request — replaces the legacy 4-globals identity pattern |
grid-classes |
WP_List_Table subclasses for admin UIs |
helper-classes |
Debug, geocoding, QR code, comments, software manager utilities |
crash-reporter |
Out-of-band error reporting; loads before plugins_loaded |
support-manager |
Support ticket submission UI |
See Architecture overview for the dependency graph and load order.
Frozen public contracts
These are public APIs that ~2K enrolled customer sites and the deployed mobile apps depend on. Their public-facing names and shapes do not change. Internal abstractions wrap them.
AJAX actions
local_app_get_phone_data— primary mobile APImam_get_phone_data— modern alias (same handler)
Option keys
local-app-account_code— customer enrollment IDlocal-app-button-array*— customer-defined button arrayslocal-app-onboarding-status— wizard progress tracker
Hooks
mam_get_phone_data_before_send— ~70 subscribersmam_local_app_data— short-circuit hookmam_notification_send_message— primary notification action (legacyadd_filterregistration retained)mam_tab_manager— per-button enrichment, ~43 subscribersmam_final_button_settings— final per-button overridemam_app_settings_get_setting/mam_app_settings_set_setting
DB tables
All 6 wp_mam_* tables (renamed from wp_tsl_* in PR #31 with backward-compat aliases):
wp_mam_debug_items,wp_mam_notification_history,wp_mam_mail_queue,wp_mam_mail_attachments,wp_mam_phone_tokens,wp_mam_sms_queue
Frozen contract — do not rename. Renaming any of the above requires a coordinated mobile-app + customer-fleet migration. Always wrap, never rename.
See Frozen public contracts reference for the full table.
Where to start
| If you want to… | Read… |
|---|---|
| Understand the platform shape | Architecture overview |
| Build an app from scratch | Recipe: Build an app end-to-end |
| Add a button to a screen | Recipe: Add a button |
| Send a notification | Hook: mam_notification_send_message |
| Inject data into the mobile JSON | Hook: mam_get_phone_data_before_send |
| Read or write a setting | Hook: mam_app_settings_get_setting |
| Register a custom field type for a Gravity Forms field | Recipe: Register a custom field type |
| Register a scheduled cron task | Hook: mam_cron_manager |
| Add a new notification type | Recipe: Register a notification type |
| Configure push notifications | Recipe: Configure push notifications |
| Publish the app to App Store / Play Store | Recipe: Publish your app to iOS and Android |
Verification
This article was last verified against:
- Plugin:
mam-mainv2.1.11 mam-main/ARCHITECTURE.mdmam-main/REFACTOR_PLAN.md- 9 per-subsystem
README.mdfiles undermam-main/includes/
Re-verify whenever a new subsystem appears under mam-main/includes/, the bootstrap order in MAM_Main_Manager::__construct() changes, or any frozen contract is added or removed.
Related articles
- Architecture overview
- Recipe: Build an app end-to-end
- Recipe: Add a button
- Recipe: Configure the tab bar
- Recipe: Configure push notifications
- Recipe: Customer enrollment and account code
- Recipe: Publish your app to iOS and Android
- Recipe: Customize onboarding
- Phone data pipeline overview
- Phone data pipeline phases
- Cursor cache mechanism
- Mobile JSON shape
- Notifications overview
- Notification types registry
- Settings cascade overview
- Frozen public contracts reference
- Forms manager overview
- Content classes overview
- Extending mam-main: developer guide
- Hook: mam_get_phone_data_before_send
- Hook: mam_notification_send_message
- Hook: mam_app_settings_get_setting
- Hook: mam_tab_manager
- Hook: mam_main_add_tab_baritem{slug}
- Hook: mam_cron_manager
Metadata
| Field | Value |
|---|---|
| Article type | Plugin Overview |
| Plugin slug | mam-main |
| Applies to plugin version | 2.1.11+ |
| Category | Plugin Reference |
| Depends on | WordPress 5.8+ |
| Requires (third-party) | Gravity Forms (recommended for any data-entry surface) |
| Works with | Every first-party MAM plugin (mam-geodirectory, mam-chat-manager, mam-special-offers, mam-geofilters, mam-inapp-purchase-manager, mam-reviews-manager, mam-gravity-forms-manager, mam-contact-form), plus all mam-suite-hold and mam-use-case plugins |
| Hooks exposed | mam_get_phone_data_before_send, mam_local_app_data, mam_notification_send_message, mam_notification_send_pn, mam_notification_list, mam_app_settings_get_setting, mam_app_settings_set_setting, mam_app_settings_get_buttons, mam_tab_manager, mam_main_add_tab_bar_item_{slug}, mam_main_skip_tab_bar_button, mam_final_button_settings, mam_cron_manager, mam_form_manager_get_forms_from_plugins, mam_form_manager_process_field_type_{type}, mam_form_manager_send_notifications, mam_user_logged_in, mam_user_roles_after_create_user, mam_main_iap_subscription_has_changed, mam_fastlane_settings, mam_plugin_entitlement |
| Last verified | 2026-05-02 |
