OnBeforeManagerLogout
Last updated Apr 12th, 2019 | Page history | Improve this page | Report an issue
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
Budget
$194 per month—let's make that $500!
Learn moreEvent: OnBeforeManagerLogout¶
Fires before a user logs out of the Manager.
- Service: 2 - Manager Access Events
- Group: Security
Event Parameters¶
| Name | Description |
|---|---|
| & user | A reference to the modUser object of the user. Passed by reference |
| userid | The user ID of the user. (deprecated) |
| username | The username of the user. (deprecated) |
| & loginContext | The context key this logout is occurring in. Passed by reference |
| & addContexts | Additional contexts in which the logout is also occurring in. Passed by reference |
Examples¶
<?php
$eventName = $modx->event->name;
switch($eventName) {
case 'OnBeforeManagerLogout':
$modx->log(modX::LOG_LEVEL_ERROR, 'User with id'.$user->get('id').' logged out in context '.$loginContext.' and also in these'.print_r($addContexts, true));
break;
}
This Plugin blocks the logout when the user tries to leave the mgr Context:
<?php
$eventName = $modx->event->name;
switch($eventName) {
case 'OnBeforeManagerLogout':
//if he tries to run away, we leave him
if ($loginContext === 'mgr'){
$response = array(
'success' => false,
'message' => "You can't go out! You are one of us .. one of us .. one of us",
'data' => array(),
);
echo $modx->toJSON($response);
exit;
}
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
Budget
$194 per month—let's make that $500!
Learn more










