Skip to content

Instantly share code, notes, and snippets.

@matdave
Last active June 4, 2017 13:56
Show Gist options
  • Save matdave/d7c364810ce8f193f403 to your computer and use it in GitHub Desktop.
Save matdave/d7c364810ce8f193f403 to your computer and use it in GitHub Desktop.
MODX Output Modifier for Serving an Alternate Chunk
<?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