forked from nodesman/wp-autoresponder
-
Notifications
You must be signed in to change notification settings - Fork 0
/
blog_series.php
196 lines (163 loc) · 5.83 KB
/
blog_series.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
<?php
function wpr_blogseries()
{
$action = $_GET['action'];
switch ($action)
{
case 'create':
_wpr_blog_series_create();
break;
case 'delete':
_wpr_blog_series_delete();
break;
default:
_wpr_blog_series_list();
}
}
function _wpr_blog_series_delete()
{
global $wpdb;
$id = $_GET['bid'];
if ($_GET['confirm'] == "true")
{
$bid = $_GET['bid'];
$query = "DELETE FROM ".$wpdb->prefix."wpr_blog_series WHERE id=".$bid;
$wpdb->query($query);
$query = "DELETE FROM ".$wpdb->prefix."wpr_followup_subscriptions where type='blogseries' and eid='$bid'";
$wpdb->query($query);
?>
<script>window.location='admin.php?page=wpresponder/blogseries.php';</script><?php
}
else
{
?>
<div class="wrap"><h2>Delete Post Series</h2></div>
<div style="background-color:#FFFF80; border: 1px solid #A4A400; padding:10px;"> Are you sure you want to delete this post series?</div>
<br />
This will not delete any blog posts or categories. It will stop sending the blog posts to users who have opted-in to receive this post series by e-mail.<br/>
<br />
<a href="<?php echo $_SERVER['REQUEST_URI'] ?>&confirm=true" class="button">Yes</a> <a href="admin.php?page=wpresponder/blogseries.php" class="button">Cancel</a>
<?php
}
}
function _wpr_blog_series_list()
{
global $wpdb;
?><div class="wrap">
<h2>Manage Post Series</h2>
<p>With post series you can use your blog posts as follow up autoresponder emails. To do so:
<ol><li>Create a new category using the Posts > Categories link (say 'Email Marketing Series').
<li>Either edit the previous posts that are part of the post series and mark them under this category or if you are yet to add the posts, add the new posts and mark the new posts under this category while publishing.</li>
<li>Create a new Post series using the "Create" button below. Select the category from step 2.</li>
<li>That's it. Now create a new subscription form. Select the follow up series to the post series you just selected. Each subscriber subscribing using that form will receive the posts in the post series in the order they were published.</li>
</ol>
</div>
<form action="<? echo $_SERVER['PHP_SELF'] ?>">
<table class="widefat">
<tr>
<thead>
<th>Name</th>
<th>Category</th>
<th>Actions</th>
</thead>
<?php
$query = "SELECT * FROM ".$wpdb->prefix."wpr_blog_series";
$bseries = $wpdb->get_results($query);
foreach ($bseries as $series)
{
?>
<tr>
<td><?php echo $series->name ?></td>
<td><?php $taxonomy = get_category($series->catid);
echo $taxonomy->name ;
?></td>
<td><input type="button" value="Delete" onclick="window.location='admin.php?page=wpresponder/blogseries.php&action=delete&bid=<?php echo $series->id ?>'" class="button" /></td>
</tr>
<?php
}
?>
</tr>
</table>
</form>
<input type="button" value="Create" onclick="window.location='admin.php?page=wpresponder/blogseries.php&action=create';" style="margin: 10px;clear:both;" class="button" />
<div style="width: 500px; background-color: #efefef; border: 1px solid #ddd; padding: 20px;"><span style="font-size: 17px; margin:10px 0px; font-weight: bold; display: block">Why Use Post Series?</span>
Often as bloggers we use post series to:
<ol>
<li>Cover a big topic more completely</li>
<li>Have more content that ranks higher in the search engines, see <a href="http://www.copyblogger.com/how-to-create-cornerstone-content-that-google-loves/">cornerstone content</a> by <a href="http://www.copyblogger.com">CopyBlogger.</a>
</ol>
Cornerstone content get a lot of traffic. You can use this content to gather more subscribers for your blog. You can do this by
offering to send this post series to the visitor over a 5-10 day period.
</div>
<?php
}
function _wpr_blog_series_create()
{
global $wpdb;
if (isset($_POST['name']))
{
$name = $_POST['name'];
$cid = $_POST['category'];
$freq = $_POST['frequency'];
if ($name)
{
$query = "INSERT INTO ".$wpdb->prefix."wpr_blog_series (name, catid,frequency) VALUES ('$name','$cid','$freq');";
$wpdb->query($query);
?>
<script>window.location='admin.php?page=wpresponder/blogseries.php'</script>
<?php
exit;
}
else
{
$error = "Name Field Is Required";
}
}
?>
<div align="center" style="color:red; font-weight:bold"><?php echo $error ?></div>
<div class="wrap">
<h2>Create Post Series</h2>
</div>
<form action="<?php echo $_SERVER['REQUEST_URI'] ?>" method="post">
<table>
<tr>
<td>Name:</td>
<td><input type="text" name="name"></td>
</tr>
<tr>
<td><div id="taxonomy">Category*</div></td>
<td><select id="taxonomylist" name="category">
<?php
$args = array(
'type' => 'post',
'child_of' => 0,
'orderby' => 'name',
'order' => 'ASC',
'hide_empty' => false,
'include_last_update_time' => false,
'hierarchical' => 0,
'pad_counts' => false );
$categories = get_categories($args);
foreach ($categories as $category)
{
if ($category->term_id ==0)
{
continue;
}
?>
<option value="<?php echo $category->term_id ?>"><?php echo $category->cat_name ?></option>
<?php
}
?>
</select>
</tr>
<tr>
<td>Time between posts :</td>
<td>Send a post every <input type="text" name="frequency" value="1" size="2" /> days.</td>
<tr>
<td><input type="submit" class="button-primary" value="Create" /></td>
</tr>
</table>
</form>
<?php
}