Restricted Downloads in Custom Module

Sep 17, 2014 1:08 pm

Hello,

Looking for some direction on restricting downloads within a custom module.

I have a custom module with three file upload fields. The Detail view for the module should be public, but the section of the detail view that displayed those uploaded files should be restricted. Any ideas?

Here is an example (non-accrisoft website):
http://www.montalvo.com/products/standard-friction-pads/
The "Drawings" tab shows two downloadable files, but the visitor must be logged in to actually download them.

Sep 18, 2014 9:39 am

With the help of some Accrisoft / Accrinet Samurais I found a solution to my problem. Here is a brief explanation for those interested.

Goal: Make the detail page of a custom module, while making some information on the page available only to those who are logged in.

The key was to create a Membership (Login/Log out HTML) Module Layout. To do this, just click "Add a New Module Layout" in the Green Interface > Layouts > Modules and then choose "Membership (Login/Log out HTML)".

I named mine "membership_loginToggle" because the layout will determine if a user is logged in or not and toggle the content accordingly.

The body of this layout looks like:

<if [[logged_in]]>loggedIn<else>loggedOut</if>

Note that there are not spaces and everything is on one line. Make sure you do this to maintain quality assurance.

Finally, in the detail layout of my custom module, I typed:

<if ([[layout.membership_loginToggle]]="loggedOut")>
        [[layout.membership_login_box]]
<else>

**SHOW FILES TO DOWNLOAD**

</if>

The Membership (Login/Log out HTML) is used in this case to create a True/False check to see if the member is logged in or not.

Sep 18, 2014 9:43 am

Thanks for the forum post Jason, this is quite helpful! Also thanks goes out to the fine folks at Accrinet - I forget who specifically first showed us this usage.