Wednesday, 18 August 2010 10:48

How to Force Users to Login before Downloading K2 Item Attachments

Written by 
How to Force Users to Login before Downloading K2 Item Attachments

One of the great uses that K2 (Joomla Component) claims that their system can do is act as a download manager.  However, it does not have the ability to restrict downloads to only logged-in users.  I needed a system where we could display the K2 item, with a preview and description, but not actually let them download the attachments.  This was not achievable using just the included K2 parameters / settings, so I made this hack:

LOOK IN THIS FILE:
/com_k2/templates/templatename/item.php (line 364)

Download the attachment (Item.php K2 Template Modification Code) for the actual changes you need to make.

(note: stock, this will appear in your K2 component folder (/components/com_k2).  You SHOULD be creating a template override (/templates/yourtemplate/html/) using the technique described here.

Read 2275 times Last modified on Wednesday, 18 August 2010 11:06

2 comments

  • Comment Link k_s_c Friday, 20 August 2010 03:41 posted by k_s_c

    Thanks for the code, looking forward to testing it...

    I hope you also appreciate the irony of offering a script to prevent downloads of attachments without registration, as an attachment that can be downloaded without registration ;-)

  • Comment Link Kipp Thursday, 19 August 2010 05:47 posted by Kipp

    Going to try it out. If it works I will holla back.

Leave a comment

Make sure you enter the (*) required information where indicated.
Basic HTML code is allowed.

Client Login



Contact Us

Covington Creations, LLC
PO Box 403
Mountainhome, PA 18342

570.595.3956 landline / fax
215.353.7786 mobile

linkedin-32x32 rss-32x32 vcard-round-32 skype32

Copyright © 2005-2015 Covington Creations, LLC | Legal