Recipe: Configure the tab bar

Goal

Configure the bottom tab bar — the persistent strip of (up to) 5 buttons across the bottom of every app screen — and understand the filter sequence that builds each tab bar item at request time.


Prerequisites

  • Buttons already created (see Recipe: Add a button)
  • Optional: a sibling plugin that needs to inject per-listing tab-bar buttons (Edit Listing, Edit Reservation, Send Notification, etc.)

Steps

1. Open Tab Bar settings

Mobile App Manager → Navigation → Tab Bar. The page lists every tab slot. Each slot stores:

  • The button id to display
  • The icon (selected from the bundled icon set: black_edit, white_person, black_share, etc.)
  • A “Show Button” toggle (visible flag)
  • An optional off-state icon and title (for buttons with toggle-state behavior)

2. Choose buttons for each tab

Pick a button from the dropdown for each tab slot. The dropdown is populated by the buttons you’ve already created in Mobile App Manager → Buttons.

3. Toggle visibility per role

Tab bar settings are per-role. Switch the role dropdown to configure each role separately. A button with Show Button unchecked is skipped at request time — the pipeline never even looks for a mam_main_add_tab_bar_item_{slug} filter for it.

4. Save

Saving writes through mam_app_settings_set_tab_bar_settings.


How tab bar items are built at request time

When the app requests phone-data, mam-main walks the configured tab bar settings and runs each enabled item through this filter sequence (in includes/app-settings/local-settings.php):

For each tab bar setting where visible === 'on':

   1. apply_filters('mam_main_skip_tab_bar_button', $tab_bar, $data_array)
        → if any subscriber returns [], the button is hidden for this item

   2. has_filter('mam_main_add_tab_bar_item_' . $id)?
        → fire it: apply_filters('mam_main_add_tab_bar_item_' . $id,
                                  $tab_bar_setting, $tab_key, $data_array['data'][$itemIndex])
        → result must be a populated array OR []
        → [] = hide this button for this item
        → if no filter is registered, mamdebug logs 'missing tabbar' and skips

   3. apply_filters('mam_tab_manager', $this_button)
        → ~43 subscribers across the suite enrich button definitions

   4. apply_filters('mam_final_button_settings', $this_button)
        → final per-button override

The result is appended to the item’s tabbar_item_array.

Static vs dynamic buttons

  • Static buttons (Share, Open URL, Phone Call) need no filter — admin configuration alone is enough. They flow straight through mam_tab_manager + mam_final_button_settings.
  • Dynamic buttons (Edit Listing, Edit Staff, Approve Listing, Send Notification) need a mam_main_add_tab_bar_item_{slug} filter to populate action, source, values, and to gate by user role.

Recipe: hide a third-party tab-bar button per item

If your plugin needs to hide a button defined elsewhere (e.g., hide the generic Share button from staff because they have a custom Edit button), register a mam_main_skip_tab_bar_button filter:

add_filter( 'mam_main_skip_tab_bar_button', function ( $tab_bar, $data_array ) {
    if ( $tab_bar['id'] === 'share_listing' && current_user_is_staff_for( $data_array['id'] ) ) {
        return array(); // hide
    }
    return $tab_bar;
}, 10, 2 );

This is preferable to gating inside an “add” filter you don’t own — the skip filter runs before the per-slug dispatch.


Verification

  • Tab bar slots saved in the admin appear in the same order in the Previewer app
  • A button with Show Button unchecked does NOT fire its mam_main_add_tab_bar_item_{slug} filter (verify with a debug log inside the callback)
  • A mam_main_skip_tab_bar_button returning [] removes the button without touching the filter chain that would otherwise enrich it
  • A mam_main_add_tab_bar_item_{slug} returning [] removes the button silently
  • A mam_main_add_tab_bar_item_{slug} returning a partially-filled array shows a broken button — return a complete array or []

  • Recipe: Add a button
  • Hook: mam_app_settings_get_tab_bar_settings
  • Hook: mam_app_settings_get_tab_bar_buttons
  • Hook: mam_main_add_tab_baritem{slug}
  • Hook: mam_main_skip_tab_bar_button
  • Hook: mam_tab_manager
  • Hook: mam_final_button_settings

Metadata

Field Value
Article type Recipe (Admin)
Plugin slug mam-main
Applies to plugin version 2.1.11+
Category Building Your App
Audience WordPress admin
Estimated time 15 minutes
Last verified 2026-05-02
Contents

    Need Support?

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