Wednesday, 18 August 2010 15:48

How to Force Users to Login before Downloading K2 Item Attachments

Written by

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.

Last modified on Monday, 18 April 2022 15:47

Latest Comments

Got a similar email that seemed suspicious. Ignored it and they even followed up today.
My organization received one of these emails from "Linda," but uses https://www.bestprosintown.com/p...
Hi Nate, I got the same email template from the same email address today and found you through a ...
Just received one today (16 Aug 2022) from "Mailchimp". Thanks for sharing!
Thanks for posting this. I just got one today. I was 99% sure it was a scam, and your post confirmed...


Design & Development

Wordpress, Drupal, Joomla
New custom websites
Bespoke themes and extensions
Redesigns, upgrades, migrations

Web Design & Development


Optimization & SEO

Let us optimize and manage your overall online presence. We offer full service monthly SEO as well as one-time projects.  

Optimization Plans & Pricing


Maintenance, Patching

White glove monthly backups, security updates, maintenance and testing for your Wordpress, Drupal, or Joomla site.

Maintenance Plans & Pricing


Email Newsletter

Bring your web & marketing performance to the next level: monthly blog post roundup via email.  

Stay in Touch!