The Twitter Lock extension for Download Monitor allows you to require users to tweet your pre-defined text before they gain access to a download.
Installation
- Unzip and upload the plugin’s folder to your /wp-content/plugins/ directory
- Activate the extension through the ‘Plugins’ menu in WordPress
For more information on installing and activating Download Monitor see here.
Usage
After installing the extension the first thing you should set up your API keys. Without valid Twitter API keys, the extension will not work.
Setup your API keys
Before you can start using the Twitter Lock extension you will need to set up a Twitter App and set the app’s API keys in your Download Monitor settings. The following steps will guide you through the process of creating a Twitter App and obtaining its API keys.
Step 1: Go to the Twitter Application Management website (log in if you’re not logged in yet) and click the Create New App button.

Skip steps 2, 3, 4, and 5 if you already have a Twitter developer account.
Please notice that the interface might look different if you have an old developer account.
Step 2: If you don’t have a Twitter developer account, you’ll need to create one. So, click Apply.

Step 3: You’ll need to fill in some information about your developer account. Once you’re done, click Next.

Step 4: Tick the box of Developer Agreement and the Twitter Developer Policy. Then, click Submit.

Step 5: Twitter will send email verification to your email address. Make sure you confirm your email.

Skip steps 2, 3, 4, and 5 if you already have a Twitter developer account.
Step 6: Let’s start creating the application. First, name your application and then click Get keys.

Step 7: Twitter will generate API keys for your application. Copy the keys and then click Skip to Dashboard.

Step 8: Add the API Key and API Key Secret to Downloads > Settings > Content Locking > Twitter Lock. Then, click Save Changes.

Step 9: Go back to your Twitter Developer Portal page and Set up the Twitter authentication settings.

Step 10: Tick the OAuth 1.0a box.

Step 11: Tick the Read and write app permissions.

Step 12: Add Callback URI / Redirect URL and Website URL. Once you’re done, click Save.

Now, you can start using the Twitter Lock extension and block your valuable content with a tweet.
Tweet Locking your Downloads
Tweet lock your downloads by editing your download in the Download Monitor screen in your WordPress backend and check the Twitter Lock option in the Download Options metabox on the right side of the screen. After checking the Twitter Lock option a tweet message field will appear where you can enter a download specific tweet message. If no message is entered the global tweet message will be used.

Note the tweet message box has a small counter on the bottom right that will display the amount of available characters left (due Twitter’s tweet length restriction).
Tweet to Unlock Download button
You can display Tweet to Unlock Download buttons anywhere on your website with the [dlm_tl_tweet_button id="DOWNLOAD_ID"]
shortcode. Replace DOWNLOAD_ID
with the ID of your download, you can find the download ID when editing the download in the Download Information metabox.
The shortcode will be replaced by this beautiful button:

Template Overriding
Like Download Monitor, the Twitter Lock extension comes with overridable template files. By overriding a template file you can change the HTML output of the plugin while still keeping the extension updatable. To override a template file, copy the file to your the download-monitor
directory in your theme (create the directory if it doesn’t exist) and modify the file you just copied to your theme any way you want. The Twitter extension comes with the following overridable template files:
tl-tweet-button.php
The HTML for the Tweet to Unlock Button discussed in the previous chapter. Note that if you only want to change the label of the button, it’s recommended to use the dlm_tl_download_button_label
filter instead of overriding this template. See the FAQ at the bottom of this page for an example on using this filter.
tl-success-screen.php
The success screen that is displayed in the popup after someone successfully unlocked the download. Note that this template part is different than most other templates because it’s a full HTML page instead of (including <head>
and <body>
tags). This template file calls wp_head();
in the header so the popup styling matches your website theme. If you only want to do CSS changes to this template file, it’s recommended to edit your theme’s style.css file or hook into WordPress’s default wp_head hook and add your custom styling instead of overriding this template file.
Learn more about overriding Download Monitors template files!
Customer Usage
After someone clicks the Tweet to Unlock Download button you’ve added via the shortcode, a popup will open. Your user will have to do the following 2 actions to unlock the download:
- Login into Twitter (this step is skipped is user is already logged in)
- Authorize your application (this step is skipped if user already authorized application)
So if a user is logged in and has already authorized your application, they will unlock the download only by clicking on the Tweet to Unlock Download button! After the download is unlocked the user will be redirected to a page where they can download the file.

Note that this screenshot is based on the current theme used when taking the screenshot, the screen will use your theme’s styling. The button shown on this page will be the default Download Monitor button template which will be styled as your other Download Monitor buttons on your website. The button is using the default Download Monitor content-download-button.php
template file, so you can override this template file to change the HTML output.
FAQ
How long will the download stay unlocked?
The download will stay unlocked as long as your user keeps the browser open, the download will be re-locked for them when the browser is closed.
Can I tweet lock multiple downloads?
You can. Please do note that when you lock multiple downloads with the same tweet message, the tweet will only be tweeted once (due Twitter’s unique tweet restriction). The user will not be notified of this, they will simply get access to the download if the tweet was tweeted or already existed.
Can I set a global unlock tweet message?
You can set a global unlock tweet at the Twitter Lock tab in your Download Monitors settings page. The Global Tweet will be used if no specific tweet message is set at a Twitter locked download.

How do I change the ‘Tweet to Unlock Download’ button text?
The button text is filterable, which means you can override its label by placing a small PHP snippet in your theme’s function.php. You can use the following code to change the button’s text:
function dlm_tl_tweet_button_text( $text ) {
return 'My custom button text';
}
add_filter( 'dlm_tl_download_button_label', 'dlm_tl_tweet_button_text' );