<?php
/* UserGroups snippet*/
/*$user = &$modx->user;
if ($user->isMember('membres') {
$output = $modx->getChunk('membres');*/
$output = 'TEST A'; /*
}
elseif ($user->isMember('administrateurs') {
$output = $modx->getChunk('administrateurs');
}
elseif ($user->isMember('employes') {
$output = $modx->getChunk('employes');
}
else {
$output = $modx->getChunk('offline');
$output = 'TEST B';
}
return $output; */return $output;
You need to return something from the snippet in order for there to be any output on the page.
Uncomment the line
return $output;
The original code sets the output to the content of one of the four chunks. The chunks must exist, must contain some text/HTML, and their names must be spelled the same in the snippet (case-sensitive) as their real names.
<?php
/* UserGroups snippet*/
$user =& $modx->user;
if ($user->isMember('membres') ) {
$output = $modx->getChunk('membres');
} elseif ($user->isMember('administrateurs') ) {
$output = $modx->getChunk('administrateurs');
} elseif ($user->isMember('employés') ) {
$output = $modx->getChunk('employés');
} else {
$output = $modx->getChunk('offline');
}
return $output;
Sorry, typos in the code -- I was typing too fast. Try this (cut and paste the code):
<?php /* UserGroups snippet*/ $user =& $modx->user; if ($user->isMember('membres') ) { $output = $modx->getChunk('membres'); } elseif ($user->isMember('administrateurs') ) { $output = $modx->getChunk('administrateurs'); } elseif ($user->isMember('employés') ) { $output = $modx->getChunk('employés'); } else { $output = $modx->getChunk('offline'); } return $output;
return "Hello from the snippet!";
Put this as the first line of the snippet:
return "Hello from the snippet!";
If that doesn’t work, your snippet name probably doesn’t match the snippet name in the tag (again, case-sensitive).


Your screenshot does not show that code at the top of the snippet. Are you sure you saved it (and cleared the site cache) after adding the line?
return "Hello from the snippet!";