Show comments only if they are entered

Since Opentools.de has now gone away I've created this forum to house FAQs and support for this mod in phpBB2.

Moderator: Experts

Locked
DavidIQ
Site Admin
Posts: 619
Joined: Thu Sep 07, 2006 4:31 pm
Location: Earth
Contact:

Show comments only if they are entered

Post by DavidIQ »

Someone on phpBB asked for this functionality so I went through the trouble of doing some edits to make the comments show only if there was a comment entered. As the mod is today the comment row is shown even if a comment is not entered for the attachment. Here's the code:

Code: Select all

# 
#-----[ OPEN ]--------------------------------------------- 
# 
attach_mod/displaying.php 

# 
#-----[ FIND ]--------------------------------------------- 
# 
            } 
          
            if ($thumbnail) 

# 
#-----[ BEFORE ADD ]--------------------------------------------- 
# 
               //Comment suppression 
               if ($comment != '') 
                  $template->assign_block_vars('postrow.attach.cat_images.switch_comment', array()); 

# 
#-----[ FIND ]--------------------------------------------- 
# 
            } 

            if ($stream) 

# 
#-----[ BEFORE ADD ]--------------------------------------------- 
# 
               //Comment suppression 
               if ($comment != '') 
                  $template->assign_block_vars('postrow.attach.cat_thumb_images.switch_comment', array()); 

# 
#-----[ FIND ]--------------------------------------------- 
# 
            } 
          
            if ($swf) 

# 
#-----[ BEFORE ADD ]--------------------------------------------- 
# 
               //Comment suppression 
               if ($comment != '') 
                  $template->assign_block_vars('postrow.attach.cat_stream.switch_comment', array()); 

# 
#-----[ FIND ]--------------------------------------------- 
# 
            } 

            if ($link) 

# 
#-----[ BEFORE ADD ]--------------------------------------------- 
# 
               //Comment suppression 
               if ($comment != '') 
                  $template->assign_block_vars('postrow.attach.cat_swf.switch_comment', array()); 

# 
#-----[ FIND ]--------------------------------------------- 
# 
                  'TARGET_BLANK'         => $target_blank) 
               ); 

# 
#-----[ AFTER ADD ]--------------------------------------------- 
# 
               //Comment suppression 
               if ($comment != '') 
                  $template->assign_block_vars('postrow.attach.attachrow.switch_comment', array()); 

# 
#-----[ FIND ]--------------------------------------------- 
# 
            // Directly Viewed Image ... update the download count 
            if (!$download_link) 

# 
#-----[ BEFORE ADD ]--------------------------------------------- 
# 
            //Comment suppression 
            if ($comment != '') 
               $template->assign_block_vars('postrow.attach.cat_images.switch_comment', array()); 

# 
#-----[ FIND ]--------------------------------------------- 
# 
         } 

         if ($stream) 

# 
#-----[ BEFORE ADD ]--------------------------------------------- 
# 
            //Comment suppression 
            if ($comment != '') 
               $template->assign_block_vars('postrow.attach.cat_thumb_images.switch_comment', array()); 

# 
#-----[ FIND ]--------------------------------------------- 
# 
            // Viewed/Heared File ... update the download count (download.php is not called here) 

# 
#-----[ BEFORE ADD ]--------------------------------------------- 
# 
            //Comment suppression 
            if ($comment != '') 
               $template->assign_block_vars('postrow.attach.cat_stream.switch_comment', array()); 

# 
#-----[ FIND ]--------------------------------------------- 
# 
            // Viewed/Heared File ... update the download count (download.php is not called here) 

# 
#-----[ BEFORE ADD ]--------------------------------------------- 
# 
            //Comment suppression 
            if ($comment != '') 
               $template->assign_block_vars('postrow.attach.cat_swf.switch_comment', array()); 

# 
#-----[ FIND ]--------------------------------------------- 
# 
               'L_DOWNLOAD_COUNT'      => sprintf($lang['Download_number'], $attachments['_' . $post_id][$i]['download_count'])) 
            ); 

# 
#-----[ AFTER ADD ]--------------------------------------------- 
# 
            //Comment suppression 
            if ($comment != '') 
               $template->assign_block_vars('postrow.attach.attachrow.switch_comment', array()); 

# 
#-----[ OPEN ]--------------------------------------------- 
# 
templates/subSilver/viewtopic_attach_body.tpl 

# 
#-----[ FIND ]--------------------------------------------- 
# 
   <tr> 
      <td width="15%" class="attachrow"><span class="genmed">&nbsp;{L_DESCRIPTION}:</span></td> 

# 
#-----[ BEFORE ADD ]--------------------------------------------- 
# 
<!-- BEGIN switch_comment --> 

# 
#-----[ FIND ]--------------------------------------------- 
# 
   <tr> 
      <td width="15%" class="attachrow"><span class="genmed">&nbsp;{L_FILESIZE}:</span></td> 

# 
#-----[ BEFORE ADD ]--------------------------------------------- 
# 
<!-- END switch_comment --> 

# 
#-----[ FIND ]--------------------------------------------- 
# 
   <tr> 
      <td width="15%" class="attachrow"><span class="genmed">&nbsp;{L_DESCRIPTION}:</span></td> 

# 
#-----[ BEFORE ADD ]--------------------------------------------- 
# 
<!-- BEGIN switch_comment --> 

# 
#-----[ FIND ]--------------------------------------------- 
# 
   <tr> 
      <td width="15%" class="attachrow"><span class="genmed">&nbsp;{L_FILESIZE}:</span></td> 

# 
#-----[ BEFORE ADD ]--------------------------------------------- 
# 
<!-- END switch_comment --> 

# 
#-----[ FIND ]--------------------------------------------- 
# 
   <tr> 
      <td width="15%" class="attachrow"><span class="genmed">&nbsp;{L_DESCRIPTION}:</span></td> 

# 
#-----[ BEFORE ADD ]--------------------------------------------- 
# 
<!-- BEGIN switch_comment --> 

# 
#-----[ FIND ]--------------------------------------------- 
# 
   <tr> 
      <td width="15%" class="attachrow"><span class="genmed">&nbsp;{L_FILESIZE}:</span></td> 

# 
#-----[ BEFORE ADD ]--------------------------------------------- 
# 
<!-- END switch_comment --> 

# 
#-----[ FIND ]--------------------------------------------- 
# 
   <tr> 
      <td width="15%" class="attachrow"><span class="genmed">&nbsp;{L_DESCRIPTION}:</span></td> 

# 
#-----[ BEFORE ADD ]--------------------------------------------- 
# 
<!-- BEGIN switch_comment --> 

# 
#-----[ FIND ]--------------------------------------------- 
# 
   <tr> 
      <td width="15%" class="attachrow"><span class="genmed">&nbsp;{L_FILESIZE}:</span></td> 

# 
#-----[ BEFORE ADD ]--------------------------------------------- 
# 
<!-- END switch_comment --> 

# 
#-----[ FIND ]--------------------------------------------- 
# 
      <td width="15%" class="attachrow"><span class="genmed">&nbsp;{L_DESCRIPTION}:</span></td> 
      <td width="75%" class="attachrow"> 

# 
#-----[ BEFORE ADD ]--------------------------------------------- 
# 
<!-- BEGIN switch_comment --> 

# 
#-----[ FIND ]--------------------------------------------- 
# 
      <td rowspan="4" align="center" width="10%" class="attachrow">{postrow.attach.attachrow.S_UPLOAD_IMAGE}<br /><a href="{postrow.attach.attachrow.U_DOWNLOAD_LINK}" {postrow.attach.attachrow.TARGET_BLANK} class="genmed"><b>{L_DOWNLOAD}</b></a></td> 

# 
#-----[ BEFORE ADD ]--------------------------------------------- 
# 
<!-- END switch_comment --> 

# 
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------ 
# 
Locked