Primary responsibility
Renders the user’s saved-items list. The actual favorites data comes from sibling plugins (mam-geodirectory contributes GD listings, mam-special-offers contributes promotions, etc.). This content class is the renderer + the AJAX favorites-sync surface.
Settings
| Setting | Type | Environment | Purpose |
|---|---|---|---|
empty_state_text |
textarea | global | Message shown when the user has no favorites |
report_favorites |
yes-no | global | If on, the app sends favorite-toggle events to the server (used by mam_manage_favorites) |
hide_remove_all_favorites |
yes-no | global | Hides the “remove all” UI link |
style_* |
various | per-button | Colors, icon |
These flags are mirrored in the phone-data JSON (report_favorites, hide_remove_all_favorites).
Hooks
| Hook | Type | Role |
|---|---|---|
mam_manage_favorites |
Action | Fires when the app reports a favorite toggle. Sibling plugins subscribe to persist the change. |
JSON shape
The favorites response section looks like:
{
"favorites": ["123", "456", "789"],
"report_favorites": "yes",
"hide_remove_all_favorites": "yes"
}
favorites is an array of post-id strings (typed as strings — many mobile clients expect strings, not integers).
Gotchas
- Source-of-truth for favorites lives in sibling plugins. mam-main provides the list view and the toggle event hook; sibling plugins persist favorites in their own usermeta keys (e.g.,
gd_user_favourite_postfor mam-geodirectory). favoritesis a strings-array, not ints. Don’t return integer ids from your sibling plugin’s contribution.
Related articles
- Content classes overview
- Hook: mam_manage_favorites
- Mobile JSON shape
Metadata
| Field | Value |
|---|---|
| Article type | Screen Reference |
| Plugin slug | mam-main |
| Applies to plugin version | 2.1.11+ |
| Category | App Settings Reference |
| Audience | WordPress admin / PHP developer |
| Class name | local_app_favorites (frozen) |
| Source file | includes/content-classes/local-app-favorites-class.php |
| Last verified | 2026-05-02 |
