Content class: Login button

Primary responsibility

Renders the app’s primary login button and owns the login-related settings (require-login, which sign-up methods are offered — email, Apple/Google — email-validation-at-signup, the login/signup screen copy and colors, Google OAuth client id, and terms-and-conditions text/URL).

The button itself is a thin shell — the actual login flow lives in mam_login_manager (includes/user-roles/login-manager.php, ~1762 lines). When a user taps Login the app POSTs to either:

  • wp_ajax_nopriv_mam_user_roles_cred_handler (legacy, frozen — older mobile clients)
  • wp_ajax_nopriv_mam_login_handler (modern alias)

Both route to the same handler.


Settings categories

Category slug Tab title Purpose
login Login Settings The single settings tab — auth toggles, sign-up methods, screen copy, colors, and OAuth/T&C config

The Login content class declares exactly one settings category (login); every setting below lives under it.


Settings exposed (selected)

Setting Type Environment Purpose
require_login yes-no global If on, the app blocks the home screen until login
sign_up_with_email yes-no global Offer email/password sign-up
sign_up_with_google yes-no global Offer “sign up with Apple and Google”
sign_up_with_email_validation yes-no global Require email validation during account setup
login_hide_lost_password yes-no global Hide the Forgot Password button
login_google_client_id text global Google OAuth client id (“Google Login API”)
login_login_button_title text global Login button label
login_signup_button_title text global Signup button label
login_top_logo_url image global Logo shown at the top of the login screen
login_background_color color global Login screen background color
login_terms_and_conditions_text text global Terms and Conditions message
login_terms_and_conditions_url text global Terms and Conditions link

The full list is read from app_settings() and rendered into the per-button settings page.


JSON keys consumed

The Login button reads:

  • local-app-login-* settings (per the schema above)
  • The current user’s role from MAM_Current_Request::get_user_role() to decide whether to render the button at all (already-logged-in users see the Logout button instead)

AJAX actions

Action Auth Handler Purpose
mam_user_roles_cred_handler both mam_login_manager::login_handler Frozen contract — legacy login endpoint, older mobile clients call it
mam_login_handler both same Modern alias

Hooks involved

Hook Type Role
mam_before_login_start Action Fired before login validation
mam_user_logged_in Action Fired after successful login
mam_login_missing_password_message Filter Override the missing-password UI copy
mam_notification_send_message Action Fired with mam-user-roles-welcome_email after first-time registration

Gotchas

  • Class name is frozen. local_app_login_button appears in every customer site’s local-app-button-array*. Renaming orphans every saved login button.
  • Two AJAX action names. Old mobile clients hit mam_user_roles_cred_handler; modern callers can use mam_login_handler. Both route to the same handler. The legacy name can’t be removed until the customer-app fleet upgrades.
  • require_login = on suppresses the home screen until the user is authenticated. If you turn this on without configuring an unauth-friendly login flow, anonymous users see a blank app.
  • Apple/Google sign-up requires additional configuration outside this button — OAuth credentials (the login_google_client_id field plus the app-side Sign in with Apple entitlement). The sign_up_with_google toggle enables the UI; it doesn’t provision the underlying credentials.

  • Content classes overview
  • Content class: Logout button
  • Hook: mam_user_logged_in
  • Hook: mam_login_missing_password_message
  • Hook: mam_notification_send_message
  • Notification types registry

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_login_button (frozen — appears in customer button arrays)
Source file includes/content-classes/local-app-login-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!