Skip to content

Instantly share code, notes, and snippets.

@Burick
Forked from matdave/devChunk
Created June 4, 2017 13:56
Show Gist options
  • Save Burick/eee2c1a0109c1be21923b58136261d6a to your computer and use it in GitHub Desktop.
Save Burick/eee2c1a0109c1be21923b58136261d6a 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