Thanks,
I tried your code and this is what I have:
<!-- Item attachments -->
<!--To control access to attachments to registered users only -->
<?php $user = JFactory::getUser(); ?>
<?php if($this->item->params->get('itemAttachments') && count($this->item->attachments)): ?>
<?php if ($user->guest): ?>
<p> Please log in to download FULL text </p>
<?php else: ?>
<?php endif; ?>
<?php endif; ?>
<!-- end control access -->
<div class="itemAttachmentsBlock">
This code simply displays the text on the top of the page "Please log in to download FULL text" but the attachment link is still visible and downloadable by users. I had a dig and found another code that used to work on Joomla 2.5, older K2 component, but when I add it to my latest K2 on Joomla 3.4 the result is the same, I see the text to login to view attachment but no attachment and if I login, still the same text but no link to attachment, this is the code:
<!-- Item attachments -->
<?php if($this->item->params->get('itemAttachments') && count($this->item->attachments) && $this->user->guest): ?>
<!--if guest -->
<div class="itemAttachmentsBlock">
<span><?php echo JText::_('K2_DOWNLOAD_ATTACHMENTS'); ?></span>
<ul class="itemAttachments">
<li>
Login to view PDF
</li>
</ul>
</div>
<!--end if guest-->
<?php else: ?>
<!--if logged in-->
<div class="itemAttachmentsBlock">
<span><?php echo JText::_("Download attachments:"); ?></span>
<ul class="itemAttachments">
<?php foreach ($this->item->attachments as $attachment): ?>
<li>
<a title="<?php echo htmlentities($attachment->titleAttribute, ENT_QUOTES, 'UTF-8'); ?>" href="<?php echo JRoute::_('index.php?option=com_k2&view=item&task=download&id='.$attachment->id); ?>">
<?php echo $attachment->title ; ?>
</a>
<?php if($this->item->params->get('itemAttachmentsCounter')): ?>
<span>(<?php echo $attachment->hits; ?> <?php echo (count($attachment->hits)==1) ? JText::_("download") : JText::_("downloads"); ?>)</span>
<?php endif; ?>
</li>
<?php endforeach; ?>
</ul>
</div>
<?php endif; ?>
<div class="clr"></div>
</div>
<!--end if logged in-->
<?php endif; ?>
I don't know what to make of it. Any suggestions?
Regards