Content class: Logout button

Primary responsibility

The Logout button. Renders only for authenticated users. Tapping it clears the app’s session state and fires the suite-wide logout actions so subscribers can clean up per-session caches.


Settings

None. Like the Login button, the Logout content class is a thin shell — get_content_type_form() returns “No settings required” and get_data_for_app() passes the category through unchanged. There are no per-button Logout settings to configure.


Hooks involved

Hook Type Role
mam_update_current_user Action Fired after current-user state is reset (the logout handler resets the request context, then fires this)

Note: mam_logout is the name of the AJAX endpoint the app calls to log out (registered in includes/app-endpoints/mam-main-endpoints.php), not an action hook. The logout handler (mam_login_manager::do_logout) revokes the session token, deletes the mam_app_token usermeta, resets MAM_Current_Request, and fires mam_update_current_user.


Gotchas

  • Class name is frozen. local_app_logout_button appears in customer button arrays.
  • Renders only when authenticated. The phone-data pipeline omits the Logout button for unauthenticated users; pair it with a Login button on the same screen so anonymous viewers see Login and authenticated users see Logout.
  • Logout doesn’t revoke push tokens. The user’s APNs/FCM token in usermeta survives logout — that’s intentional (the device is still registered with this user). To revoke a token, use the user-roles AJAX endpoints from the device.

  • Content classes overview
  • Content class: Login button
  • Hook: mam_user_logged_in

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_logout_button (frozen)
Source file includes/content-classes/local-app-logout-class.php
Last verified 2026-05-02
Was this article helpful?
Contents

    Need Support?

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