Jump to main content Jump to doc navigation

Event: OnManagerLogin

Fires after a user logs into the manager, once the authentication checks have passed. The event does not affect the authentication process.

  • Service: 2 - Manager Access Events
  • Group: Security

Event Parameters

Name Description
user The modUser that just logged in.
attributes An array with:
- rememberme — whether the user asked to remember the login
- lifetime — session cookie lifetime for this login
- loginContext — context key for this login
- addContexts — extra contexts that also received a session

Event Login Workflow

  1. OnBeforeWebLogin || OnBeforeManagerLogin — a non-true output aborts the login with that message.
  2. OnUserNotFound — runs only when the username is missing from the MODX database. A Plugin may supply its own modUser to continue.
  3. OnWebAuthentication || OnManagerAuthentication — overrides the default password check. A true output marks the user as verified and logged in.
  4. OnWebLogin || OnManagerLogin — fires after the login has finished. It does not change the login outcome.

Example

Log who logged in and with which attributes:

<?php
$eventName = $modx->event->name;
switch($eventName) {
    case 'OnManagerLogin':
        $id = $user->get('id');
        $modx->log(modX::LOG_LEVEL_ERROR, 'User logged in with id '.$id.' '.print_r($attributes, true));
        break;
}

See Also

Support the team building MODX with a monthly donation.

The budget raised through OpenCollective is transparent, including payouts, and any contributor can apply to be paid for their work on MODX.

Backers

  • modmore
  • STERC
  • Digital Penguin
  • Jens Wittmann – Gestaltung & Entwicklung
  • CrewMark
  • Fabian Christen
  • Sepia River Studios
  • Dannevang Digital
  • A. Moreno
  • Alex
  • Chris Fickling
  • Stéphane Jäggi
  • YJ
  • Murray Wood
  • JT Skaggs
  • Anton Tarasov
  • deJaya
  • Lefthandmedia
  • eydolan
  • Following Sea
  • Guido Gallenkamp
  • Raffy
  • Snow Creative
  • Nick Clark
  • Guest
  • Helen
  • krisznet
  • Yanni
  • Richard

Budget

$185 per month—let's make that $500!

Learn more