If you want to ask people to provide their name and email address before permitting them to download a file, here is a simple method that makes use of the plugin com_connect.
- Download the most recent release of com_connect.
- Install and activate the plugin.
Create a signup form article
In the article that will contain the signup form requesting access to the file download, enter the following:
<txp:com_connect to="your-email@example.com" thanks_form="file_download">
<txp:com_connect_text label="Name" />
<txp:com_connect_text label="Organisation" />
<txp:com_connect_email />
<txp:com_connect_submit label="Get File" />
</txp:com_connect>
Replace the email address in the above code and save the above code in your article.
Create a file_download form
In the Presentations › Forms pane, create a form of type misc and name it file_download
with the following content.
<p>Thank you. Download your file <a href="https://yoursite.com/file_download/6" title="some title">here</a>.</p>
Again, edit the text as required and change the link to match the download link of your file.
After visitors to your site have successfully submitted the form, the thanks form will be displayed with the link to the file.
Great tip! I have a client who wanted this, but didn’t want people to have to click on the link to download the file — just wanted to have it download as soon as the user submitted the form. So I worked a little magic with the great smd_if plugin.
I did this before txp:variable came around so this might be possible without the smd_if plugin …
In the article the first line of the zem_contact plugin specify the file you want to download like this:
Then I created a section called “download” with this code between the <head> and </head> tags:
Then, just for good measure, I put the download link down in the body of the page just in case the user’s browser doesn’t refresh:
I’m sure this could be refined, but it seems to work well.