array ( 'criteria' => array ( 'name' => 'loglogins', ), 'object' => array ( 'name' => 'loglogins', 'path' => '{core_path}components/loglogins/', 'assets_path' => '', ), ), '7104b87cadd0313492b124c744ad825d' => array ( 'criteria' => array ( 'category' => 'LogLogins', ), 'object' => array ( 'id' => 19, 'parent' => 0, 'category' => 'LogLogins', 'rank' => 0, ), ), 'a6a69e423ce77aad3b96c4bfd5e6dbf4' => array ( 'criteria' => array ( 'name' => 'LogLogins', ), 'object' => array ( 'id' => 10, 'source' => 0, 'property_preprocess' => 0, 'name' => 'LogLogins', 'description' => '', 'editor_type' => 0, 'category' => 19, 'cache_type' => 0, 'plugincode' => '/** @var $modx modX */ $pluginKey = \'loglogins_contexts\'; /* Set action based on event name */ if (strpos($modx->event->name, \'Login\') !== false) { $act = $modx->lexicon(\'login\'); } else { $modx->lexicon->load(\'core:default\'); $act = $modx->lexicon(\'logout\'); } /* Need this because $modx->user is not available in some cases and MODX uses it for the actor in logManagerActions()*/ if (isset($user)) { $modx->user =& $user; } $allContexts = array(); /* These are from the vars passed to the event on login. Converted here to a comma-separated string */ $ac = isset($attributes[\'addContexts\']) ? $attributes[\'addContexts\'] : array(); $lc = isset($attributes[\'loginContext\']) ? $attributes[\'loginContext\'] : \'\'; if ( (empty($ac))) { $allContexts[] = $lc; } else { $allContexts = $ac; if (! in_array($lc, $ac)) { $allContexts[] = $lc; } } $msg = !empty($allContexts)? implode(\',\', $allContexts) : \'\'; /* $msg is always \'mgr\' for manager logins and logouts */ if (strpos($modx->event->name, \'Manager\') !== false) { $msg = \'mgr\'; } switch ($modx->event->name) { /* Save contexts in user setting */ case \'OnWebLogin\': $setting = $modx->getObject(\'modUserSetting\', array( \'user\' => $user->get(\'id\'), \'key\' => $pluginKey, )); if (! $setting) { /* Create User Setting if it doesn\'t exist */ $setting = $modx->newObject(\'modUserSetting\'); $setting->set(\'user\', $user->get(\'id\')); $setting->set(\'key\', $pluginKey); $setting->set(\'namespace\', \'loglogins\'); } /* Set value to login contexts */ if ($setting) { $setting->set(\'value\', $msg); $setting->save(); } break; case \'OnWebLogout\': /* Get contexts from user setting */ $setting = $modx->getObject(\'modUserSetting\', array( \'user\' => $user->get(\'id\'), \'key\' => $pluginKey, )); if ($setting) { $msg = $setting->get(\'value\'); } else { $msg = \'\'; } break; } $modx->logManagerAction($act, \'modContext\', $msg); return \'\';', 'locked' => 0, 'properties' => 'a:0:{}', 'disabled' => 1, 'moduleguid' => '', 'static' => 0, 'static_file' => '', 'content' => '/** @var $modx modX */ $pluginKey = \'loglogins_contexts\'; /* Set action based on event name */ if (strpos($modx->event->name, \'Login\') !== false) { $act = $modx->lexicon(\'login\'); } else { $modx->lexicon->load(\'core:default\'); $act = $modx->lexicon(\'logout\'); } /* Need this because $modx->user is not available in some cases and MODX uses it for the actor in logManagerActions()*/ if (isset($user)) { $modx->user =& $user; } $allContexts = array(); /* These are from the vars passed to the event on login. Converted here to a comma-separated string */ $ac = isset($attributes[\'addContexts\']) ? $attributes[\'addContexts\'] : array(); $lc = isset($attributes[\'loginContext\']) ? $attributes[\'loginContext\'] : \'\'; if ( (empty($ac))) { $allContexts[] = $lc; } else { $allContexts = $ac; if (! in_array($lc, $ac)) { $allContexts[] = $lc; } } $msg = !empty($allContexts)? implode(\',\', $allContexts) : \'\'; /* $msg is always \'mgr\' for manager logins and logouts */ if (strpos($modx->event->name, \'Manager\') !== false) { $msg = \'mgr\'; } switch ($modx->event->name) { /* Save contexts in user setting */ case \'OnWebLogin\': $setting = $modx->getObject(\'modUserSetting\', array( \'user\' => $user->get(\'id\'), \'key\' => $pluginKey, )); if (! $setting) { /* Create User Setting if it doesn\'t exist */ $setting = $modx->newObject(\'modUserSetting\'); $setting->set(\'user\', $user->get(\'id\')); $setting->set(\'key\', $pluginKey); $setting->set(\'namespace\', \'loglogins\'); } /* Set value to login contexts */ if ($setting) { $setting->set(\'value\', $msg); $setting->save(); } break; case \'OnWebLogout\': /* Get contexts from user setting */ $setting = $modx->getObject(\'modUserSetting\', array( \'user\' => $user->get(\'id\'), \'key\' => $pluginKey, )); if ($setting) { $msg = $setting->get(\'value\'); } else { $msg = \'\'; } break; } $modx->logManagerAction($act, \'modContext\', $msg); return \'\';', ), ), );