Skip to content

Instantly share code, notes, and snippets.

@dannevang
Created May 15, 2014 23:18
Show Gist options
  • Select an option

  • Save dannevang/b7f37a9edf19b0c7ea85 to your computer and use it in GitHub Desktop.

Select an option

Save dannevang/b7f37a9edf19b0c7ea85 to your computer and use it in GitHub Desktop.
Show MODX chunk based on usergroup membership
<?php
/* ShowChunk snippet : Credit: Bob Ray */
$subChunks = explode(',', $scriptProperties['subscriberChunks']);
$otherChunks = explode(',', $scriptProperties['otherChunks']);
if ($modx->user->isMember('paid-members')) {
foreach ($subChunks as $subChunk) {
$output .= $modx->getChunk($subChunk);
}
} else {
foreach ($otherChunks as $otherChunk) {
$output .= $modx->getChunk($otherChunk);
}
}
return $output;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment