We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 4041
    • 788 Posts
    Your very welcome by the way
    Normally the unset placeholders are just removed if they have no value so lets try another method smiley

    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.]
      xforum
      http://frsbuilders.net (under construction) forum for evolution
      • 18961 ☆ A M B ☆
      • 237 Posts
      Absolutely perfect. Does exactly what I needed it to do. I can't thank you enough. I'm always amazed at how helpful everyone is on the forum. I hope to be helpful to someone here one day as well.

      Thanks so much!
        Michael Smull
        http://www.bigpixelstudio.com
        twitter: @mdsdesign