Last active
June 4, 2017 13:56
-
-
Save matdave/d7c364810ce8f193f403 to your computer and use it in GitHub Desktop.
MODX Output Modifier for Serving an Alternate Chunk
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 | |
/** devChunk MODX Output Modifier ** | |
** | |
** Returns an alternate chunk to users in the groups defined below | |
** Usage [[$livechunk:devChunk=`alternatechunk`]] | |
** | |
**/ | |
$user = $modx->getUser(); | |
$restricted = true; | |
if($user) { | |
//set restricted user groups | |
$restricted = (!$user->isMember(array('Administrator','Manager'))); | |
} | |
if($restricted || !$options || empty($options)){ | |
return $input; | |
}else{ | |
$dev = $modx->getChunk($options); | |
return $dev; | |
} | |
return ''; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment