So here is some code that I think should work:
<?php
if ($modx->context->get("key") != "mgr") {
if ($modx->event->name == "OnHandleRequest") {
if (!$modx->checkSiteStatus()) {
$forwardId = $modx->getOption('site_unavailable_page', null, 1);
$modx->sendForward($forwardId);
}
}
}
It’s for the OnHandleRequest event.
(If you experience any problems with this code or don’t need the functionality any longer, just deactivate the plugin.)