Your very welcome by the way
Normally the unset placeholders are just removed if they have no value so lets try another method
Use this code, leave the snippet call as is, and remove the [+document placeholder.
<?php
/*
usage:
add the following snippet call to either your template or document
content where you want the tv to appear
[!show_specific_tvs?
&tvs=`forum_lock,super_admin,can_post,can_view,can_edit`
&groups=`Forum Admin,Forum Moderator`
!]
** note that &tvs=`` are the names of the tvs used on the
create/edit tv screen, not the display names used on
the document edit screen
*/
$tvs = isset($tvs) ? $tvs : '';
$groups = isset($groups) ? $groups : '';
$valid =FALSE;
$output ='';
// check and see if the current user
// is in one of the valid groups
if(isset($_SESSION['webUserGroupNames']) && $_SESSION['webUserGroupNames'] !=''){
$xplod_groups = explode(',',$groups);
foreach($_SESSION['webUserGroupNames'] as $key=>$value){
if(in_array($value,$xplod_groups) && $valid !=TRUE){
$valid =TRUE;
}
}
// if user groups is ok, get the template variables
if($valid ==TRUE){
$tv_values =$modx->getTemplateVarOutput(
explode(',',$tvs),
$docid=$modx->documentObject['id'],
$published=1);
foreach($tv_values as $key1=>$value1){
$output .=$value1;
//$modx->setPlaceholder($key1,$value1);
}
}
return $output;
}
?>
[ed. note: breezer last edited this post 14 years, 11 months ago.]