-
-
Save CrazyBoy49z/8e16c3d044fdcdfd6bc06c2ba4c4d5f2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
switch ($modx->event->name) { | |
case 'OnLoadWebDocument': | |
$id = 1; // id ресурса куда послать в случае чего | |
$res = array(1,2,3); // id ресурсов | |
if($modx->user->isAuthenticated(‘mgr’) && in_array($modx->resource->id, $res)) { | |
//разрешаем показать | |
} | |
elseif(!$modx->user->isAuthenticated(‘mgr’) && in_array($modx->resource->id, $res)) { | |
// заперщаем | |
$modx->sendRedirect($modx->makeUrl((!empty($id)) ? $id : $modx->getOption('site_start'), '', '', 'full')); | |
} | |
break; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment