Keyword

Show descriptions to all, allow downloads for registered only?

  • Diorist
  • Diorist's Avatar Topic Author
  • Offline
  • New Member
More
15 years 1 month ago #73729 by Diorist
Please forgive me if this has been covered...I did look, but didn't find a direct answer.

Is there a way, using K2's own features, to let all users see an item description, but let only registered users download the item?

Yes, I saw the post about jhide, but that would be a klugey workaround. Is there a way to show content/protect downloads with K2 itself?

I love the elegance and power of the extension, but I can't use it if it doesn't allow this feature.

Thanks!
Diorist

Please Log in or Create an account to join the conversation.

More
15 years 1 month ago #73730 by vtiger
This solution require to modify component core file, but works for me.

Modify function getItemAttachments in components\com_k2\models\item.php

to

function getItemAttachments($itemID){
global $mainframe;
$user = JFactory::getUser();
$db = & JFactory::getDBO ();
$query="SELECT * FROM #__k2_attachments WHERE itemID={$itemID}";
$db->setQuery($query);
$rows = $db->loadObjectList();
if (!$user->guest){
return $rows;
}
else {
return;
}
}

Please Log in or Create an account to join the conversation.

More
15 years 1 month ago #73731 by vtiger
or add condition to your tempate file

$user = JFactory::getUser(); if($this->item->params->get('itemAttachments') && count($this->item->attachments) && !$user->guest ):




...

Please Log in or Create an account to join the conversation.


Powered by Kunena Forum