Last active
June 4, 2017 13:53
-
-
Save matdave/ce7535a41b546c694e06 to your computer and use it in GitHub Desktop.
HideDeleted
This file contains 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 | |
/* Set plugin to run on "OnManagerPageBeforeRender" | |
*/ | |
$user = $modx->getUser(); | |
$restricted = true; | |
if($user) { | |
$restricted = (!$user->isMember(array('Administrator'))); | |
} | |
if($restricted){ | |
$modx->regClientStartupHTMLBlock('<style type="text/css">.deleted{display:none;}</style>'); | |
} |
This file contains 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 | |
/* First create a resource named "Trash Can" or whatever and set it to list access only | |
* Note the ID of that resource for the following plugin | |
* Set plugin to run on "OnDocFormDelete" and "OnResourceDelete" | |
*/ | |
$trashcan = 33; //RESOURCE ID OF TRASHCAN | |
if(!empty($resource)){ | |
if($resource->get('parent') != $trashcan && $id != $trashcan){ | |
$resource->set('parent',$trashcan); | |
$resource->set('deleted',0); | |
$resource->set('published',0); | |
$resource->save(); | |
} | |
if($id == $trashcan){ | |
$resource->set('deleted',0); | |
$resource->save(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment