Ah ... I thought they would be logged in. You could use a $_SESSION variable, but it would be only be good for that visit.
I'm not sure anything else is viable since the user could be visiting from a different browser, computer, tablet, or phone for different visits.
if ($modx->resource->get('id') != 22) { // id of protected page
return;
}
$v = 'visted' . $modx->resource->get('id');
if (!isset($_SESSION[$v])) {
$_SESSION[$v] = '1';
$modx->sendRedirect($modx->makeUrl(12, "", "", "full)); // id of page to forward to
}
I would still use a snippet and take out the first "if". Otherwise you're going to execute that top code on every page load for every resource for no reason.
------------------------------------------------------------------------------------------
PLEASE, PLEASE specify the version of MODX you are using.
MODX info for everyone:
http://bobsguides.com/modx.html