Require a user’s email before downloading a file with wordpress

By February 10, 2013 Web Design 4 Comments

I have created some presentations on various topics including one on Best Practices for Personalization with IBM WebSphere Portal that I am going to post shortly to Base22.com but before I do, I don’t want to just give it away for free, I want to at least collect the email address of users so I can send them updates or ask if they want to schedule a discussion. Note: Our website used wordpress when I wrote this, now we just a different method.

Assuming you use wordpress, here is how you can require a user to fill in a form in order to get access to a download.

Step 1: Installed the plugin Email Before Download - Email Before Download presents your users with a form where they submit information, like their name and email address, prior to receiving a download. This plugin integrates with the popular Contact Form 7 and WordPress Download Monitor plugins, allowing you to create any form you like and manage/monitor your file downloads.

Step 2: Installed Contact Form 7 - Contact Form 7 can manage multiple contact forms, plus you can customize the form and the mail contents flexibly with simple markup. The form supports Ajax-powered submitting, CAPTCHA, Akismet spam filtering and so on.

Step 3: Install Download Monitor – WordPress Download Monitor Even though it is no longer supported, it still works.

Ok. So now let’s test:

I uploaded a small image as the file.

    Download requires your emailPlease complete the following for access to the free download. A link will be sent to your email. It might go to spam so check.

[email-download download_id=”1″ contact_form_id=”17226″]

Join the discussion 4 Comments

  • mp459 says:

    Hey Ben

    How did you get the link to expire in 1 hour?

    Y

    • benshoemate says:

      That is a setting of the “Email Before Downloading plugin”. It works by masking the real url to the file using cURL function of PHP.

      It requires the cURL php extention to be enabled, which is done by uncommenting it from the php.ini file.

      Then it creates an alias to the file that the plugin manages. After the configured time (1hr) it deleted the alias. The other options are never, 1min, 3min, 10min, 30min, 1hr, 12hr, 1 day, or 1 week.

  • Sébastien Löffler says:

    Hello Ben,
    i’m looking for a similar solution, but not on WP. What ‘different method’ are you using now ?
    Thanks a lot

Leave a Reply