Subscribe to Download in WordPress using Feedburner

subscribe & download feedburner

Subscribe to Download in WordPress using Feedburner:

When you want to become a good blogger or want to make your blog more reachable then having subscription is very important to keep your regular and new readers updated about your valuable post/content. Just keeping subscription form in sidebar/footer/popup may not give you good subscription numbers, so when you have something for your users to download then asking them to subscribe before giving the download link will help you to get more subscription.

Email Subscription for your blog can be done using N lot of ways, but feedburner is good out of all. You can find lot of posts stating “stop using feedburner for your subscriptions“.

If you are a blogger then I recommend only feedburner for email subscription because of these features,

1. Google’s product (even google is not doing much update on that, it’s still good to use for blogs).

2. Automatically sends your blog post update to your subscribers (in some plugins like Newsletter, we need to send the update to our subscribers all the time manually)

3. Two step subscription (one step subscription is adding the email id to the subscription list without confirmation, where as two step subscription will add the email only after the confirmation).

4. CSV file download (If you like to change to mailchimp or any other newsletters then you can directly import the subscribers using the downloaded csv file).

subscribe to download in wordpress
demo
download

What we need to do to achieve

subscribe to download in wordpress using feedburner:

1. Create a HTML file with two email id field (one for new subscribers and other one for already subscribed users)

2. Create two table in your MySQL

subscribe_email ( have only ID and Email fields)

subscribe_download ( have all the post title, id, download link and tutorial link)

3. We have to download the subscribers from feedburner as CSV file on daily basis and upload the same to MySQL subscribe_email table.

[If you have idea on cron_jobs then half of the work can be done automatically, means you can just download and keep the file somewhere in your server, then a small PHP script will automatically read and insert to the subscribe_email table]

4. We have to redirect to the created html file all the time with the post id, this will be referred in the download table to provide the download link after confirming whether the user’s email id in subscribe_email table.

If they are new then they will subscribe to get download link, after the confirmation we will be adding them to our subscribe_email table manually, automatically or using cron jobs. [I am doing manually only, it’s not taking more than 5mins per day].

Also notify your newly subscribed reader/user that they got the download access now.

Create subscribe_email Table:

CREATE TABLE `subscribe_email` (
`id` int(10) NOT NULL AUTO_INCREMENT,
`email` varchar(300) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=40 DEFAULT CHARSET=latin1

Sample Insertion Snippet:

email table insertion sample

Create Query for subscribe_download table:

CREATE TABLE `subscribe_download` (
`post_id` int(10) NOT NULL,
`post_title` varchar(300) NOT NULL,
`post_link` varchar(400) NOT NULL,
`download_link` varchar(1000) NOT NULL,
PRIMARY KEY (`post_id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1

Sample Insertion Snippet:

downloadl table insertion sample

dbConfig.php:

$dbhost = 'localhost';
$dbuser = 'USER_NAME_OF_DB';
$dbpass = 'DB_PASSWORD';
$conn = mysql_connect($dbhost, $dbuser, $dbpass);
$item_per_page = 100;
if(! $conn )
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db('DB_NAME');

index.html:

<div class="search">
	<div class="container">
		<div class="row">
			<div class="col-md-10 col-md-offset-1 search-header">
				<div class="row">
					<div class="col-md-6 col-xs-12 col-sm-6 col-lg-6">
						<form action="http://feedburner.google.com/fb/a/mailverify" method="post" target="popupwindow" onsubmit="window.open(" http:="" feedburner.google.com="" fb="" a="" mailverify?uri="javadomainin'," 'popupwindow',="" 'scrollbars="yes,width=300,height=220');return" true'="">
							<label for="InputEmail_existing">I'm new ? <br/> Want to subscribe</label>
							<div class="form-group">
								<input type="text" class="form-control" name="email">
									<input type="hidden" value="Javadomainin" name="uri">
										<input type="hidden" name="loc" value="en_US">
										</div>
										<button type="submit" class="btn btn-default btn-info" onclick="feedback()">Subscribe to get download access</button>
									</form>
								</div>
								<div class="col-md-6 col-xs-12 col-sm-6 col-lg-6">
									<div class="form-group">
										<label for="InputEmail_existing">Already Subscribed ? <br/> Enter your subscribed email id to get the download link instantly</label>
										<div class="input-group">
											<input type="email" class="form-control" id="InputEmail_existing" name="InputEmail_existing" placeholder="Enter Your Email" required >
												<span class="input-group-addon">
													<i class="glyphicon glyphicon-ok form-control-feedback"/>
												</span>
											</div>
										</div>
										<button type="submit" class="btn btn-default btn-info" onclick="getInstantDownloadLink();">Get Instant Download Link</button>
									</div>
								</div>
							</div>
						</div>
					</div>
				</div>

				<div class="container" style="margin-top:50px;">
					<div class="row">
						<div class="col-md-offset-3 col-md-12" style="margin-top:20px;padding-top:30px;">
							<div class="DownloadLink text-center col-md-6" style="background-color:#3498db;color:white;height:100px;padding-top:15px;">

							</div>
						</div>
					</div>
				</div>

getDownloadLink.php:

include ("dbConfig.php");
/*
Site: Javadomain.in
Author: Naveen kumar Gunasekaran
Subscribe to get all the tutorials to your email!
*/

if(isset($_POST['Email_ID']) &amp;&amp; isset($_POST['Post_ID'])){
$searchParam = $_POST['Email_ID'];
$postParam = $_POST['Post_ID'];

$existingEmail = str_replace(" ","",$searchParam);
$postID = str_replace(" ","",$postParam);
// Email where query

$emailQuery = "SELECT email FROM `subscribe_email` where email='$existingEmail'";
$emailChekQuery = mysql_query($emailQuery) or die(mysql_error());
$emailRow=mysql_fetch_array($emailChekQuery);

if(!empty($emailRow['email'])){
$dwnQuery ="SELECT download_link FROM `subscribe_download` where post_id=$postID";
$downLinkQuery = mysql_query($dwnQuery) or die(mysql_error());
$linkQry = mysql_fetch_array ( $downLinkQuery );
echo $linkQry['download_link'];
}else{
echo 'You are not subscribed to javadomain, Please subscribe to get the download link &lt;br/&gt;&lt;p&gt; Download access will be enabled within 5 hours from the time of subscription &lt;/p&gt;&lt;br/&gt;';
}

}else{
echo "something went wrong, please notify to admin [Naveen@ngdeveloper.com]";
}

Implement this subscribe to download script in your wordpress websites with feedburner, which helps you to get more subscribers with the free resources you have.

Download our script, which will have all the source codes and sql files. Set up this script in just 2 mins in your site.

Leave a Reply