Version Description
- Fixed the bug where random posts where only posting in the AM.
Download this release
Release Info
Developer | talus |
Plugin | Drafts Scheduler |
Version | 1.7 |
Comparing to | |
See all releases |
Code changes from version 1.5 to 1.7
- draft-scheduler.php +65 -58
- readme.txt +17 -3
draft-scheduler.php
CHANGED
@@ -2,10 +2,13 @@
|
|
2 |
/*
|
3 |
Plugin Name: Drafts Scheduler
|
4 |
Plugin URI: http://www.installedforyou.com/draftscheduler
|
|
|
5 |
Description: Allows WordPress admins to bulk schedule posts currently saved as drafts
|
6 |
Author: Jeff Rose
|
7 |
-
Version: 1.
|
8 |
Author URI: http://www.installedforyou.com
|
|
|
|
|
9 |
|
10 |
*/
|
11 |
|
@@ -40,31 +43,16 @@ if (!class_exists('DraftScheduler')) {
|
|
40 |
* Primarily connects the WP hooks
|
41 |
*/
|
42 |
function DraftScheduler() {
|
43 |
-
//add_action('init', array(&$this, 'draftScheduler_Init'));
|
44 |
|
45 |
add_action('admin_menu', array(&$this,'draftScheduler_Admin'));
|
46 |
}
|
47 |
|
48 |
-
/*
|
49 |
-
* function draftScheduler_Init
|
50 |
-
* @todo: I don't think I need anything here, yet.
|
51 |
-
*/
|
52 |
-
function draftScheduler_Init() {
|
53 |
-
// wp_register_script(
|
54 |
-
// 'draftScripts',
|
55 |
-
// DraftScheduler_root . 'js/jquery-ui-1.7.2.custom.min.js',
|
56 |
-
// array('jquery'),
|
57 |
-
// ''
|
58 |
-
// );
|
59 |
-
}
|
60 |
-
|
61 |
/*
|
62 |
* function draftScheduler_Admin
|
63 |
* Sets up the Admin page for the user to schedule draft posts
|
64 |
*/
|
65 |
function draftScheduler_Admin() {
|
66 |
add_posts_page('Draft Scheduler', 'Draft Scheduler', 'administrator', 'draft_scheduler', array(&$this, 'draftScheduler_manage_page'));
|
67 |
-
//wp_enqueue_script('draftScripts');
|
68 |
}
|
69 |
|
70 |
/*
|
@@ -118,15 +106,15 @@ if (!class_exists('DraftScheduler')) {
|
|
118 |
$msg = "Posts un-scheduled.";
|
119 |
}
|
120 |
|
121 |
-
if ( !empty($_POST) && $_POST["action"] !="undo" && check_admin_referer('do-schedule-drafts') ) {
|
122 |
$msg = '';
|
123 |
-
if (!$_POST["action"] == "schedule_drafts") {
|
124 |
/*
|
125 |
* No action set, so just return
|
126 |
*/
|
127 |
return $msg;
|
128 |
} else {
|
129 |
-
if (!j_is_date($_POST['startDate'])) {
|
130 |
$msg = 'Please enter a valid date to start posting';
|
131 |
return $msg;
|
132 |
}
|
@@ -134,6 +122,7 @@ if (!class_exists('DraftScheduler')) {
|
|
134 |
$startDate = $_POST['startDate'];
|
135 |
$startTime = $_POST['startTime'];
|
136 |
$endTime = $_POST['endTime'];
|
|
|
137 |
|
138 |
$dailyMax = $_POST['postsperday'];
|
139 |
$exactPosts = $_POST['exactPosts'];
|
@@ -141,7 +130,7 @@ if (!class_exists('DraftScheduler')) {
|
|
141 |
$intHours = $_POST['intHours'];
|
142 |
$intMins = $_POST['intMins'];
|
143 |
|
144 |
-
if ($_POST['randomness'] == "sequential" || $_POST['randomness'] == "random") {
|
145 |
if ( !is_numeric( $intHours ) || ( $intHours =='' ) || ( 24 < $intHours ) || (0 > $intHours ) ) {
|
146 |
$msg = 'Please enter a valid Post Interval';
|
147 |
return $msg;
|
@@ -161,23 +150,23 @@ if (!class_exists('DraftScheduler')) {
|
|
161 |
return $msg;
|
162 |
}
|
163 |
|
164 |
-
if (strtotime($startTime) > strtotime($endTime)) {
|
165 |
$msg = 'Ensure the start time is before the end time.';
|
166 |
return $msg;
|
167 |
}
|
168 |
}
|
169 |
|
170 |
-
if ($_POST['randomness'] == "sequential"){
|
171 |
|
172 |
-
$msg = $this->draftScheduler_sequential_post_by_interval($startDate, $intHours, $intMins);
|
173 |
|
174 |
-
} else if ($_POST['randomness'] == "random") {
|
175 |
|
176 |
-
$msg = $this->draftScheduler_random_post_by_interval($startDate, $intHours, $intMins);
|
177 |
|
178 |
} else {
|
179 |
|
180 |
-
$msg = $this->draftScheduler_randomize_drafts( $startDate, $startTime, $endTime, $dailyMax, $exactPosts );
|
181 |
}
|
182 |
|
183 |
return $msg;
|
@@ -229,7 +218,7 @@ if (!class_exists('DraftScheduler')) {
|
|
229 |
<th scope="row">Schedule Start Date</th>
|
230 |
<td>
|
231 |
<div id="datepicker"></div>
|
232 |
-
<input type="text" name="startDate" id="startDate" size="31" value="<?php echo $_POST['startDate']; ?>" />
|
233 |
<br />
|
234 |
Note: if you schedule starts "Today" then posting will start from midnight, including before "now."<br />You may wish to start tomorrow.
|
235 |
</td>
|
@@ -257,7 +246,12 @@ if (!class_exists('DraftScheduler')) {
|
|
257 |
<th scope="row">Post Randomly</th>
|
258 |
<td>
|
259 |
<input type="radio" name="randomness" value="fullrandom" <?php if ($_POST['randomness'] == "fullrandom") echo " checked " ?>> Surprise me <em>(posts entirely randomly after the date above, but within the times below)</em><br />
|
260 |
-
Post up to <input type="text" name="postsperday" id="postsperda" value="<?php echo $_POST['postsperday']; ?>" size="3" maxlength="3" /> posts per
|
|
|
|
|
|
|
|
|
|
|
261 |
Post exactly <input type="text" name="exactPosts" id="exactPosts" value="<?php echo $_POST['exactPosts']; ?>" size="3" maxlength="3" /> posts per day<br />
|
262 |
Randomly after:
|
263 |
<select name="startTime" id="startTime">
|
@@ -290,7 +284,7 @@ if (!class_exists('DraftScheduler')) {
|
|
290 |
* function draftScheduler_randomize_drafts
|
291 |
*
|
292 |
*/
|
293 |
-
function draftScheduler_randomize_drafts($startDate, $startTime, $endTime, $dailyMax = "", $exactPosts = "" ) {
|
294 |
|
295 |
global $wpdb;
|
296 |
|
@@ -300,7 +294,7 @@ if (!class_exists('DraftScheduler')) {
|
|
300 |
$postsToday = $exactPosts;
|
301 |
}
|
302 |
|
303 |
-
$startPosts = date_i18n( 'Y-n-j
|
304 |
|
305 |
$randInterval = (strtotime($endTime) - strtotime($startTime));
|
306 |
|
@@ -317,27 +311,40 @@ if (!class_exists('DraftScheduler')) {
|
|
317 |
$finished = false;
|
318 |
|
319 |
while ( ! $finished ):
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
329 |
|
330 |
$thisDraft = array_pop( $draftList );
|
331 |
|
332 |
$postRandom = rand( 0, $randInterval );
|
333 |
-
$postTime = date_i18n('Y-n-j G:i:s', strtotime( "+" . $postRandom . " seconds", strtotime($startPosts)));
|
334 |
|
335 |
-
$this->update_post_details( strtotime($postTime), $thisDraft->ID );
|
336 |
$whole_post = get_post( $thisDraft->ID );
|
337 |
-
wp_transition_post_status( 'draft', 'future', $whole_post);
|
338 |
check_and_publish_future_post( $thisDraft->ID );
|
339 |
|
340 |
-
if ( 0 == count($draftList) ){
|
341 |
$finished = true;
|
342 |
}
|
343 |
$postsToday --;
|
@@ -359,27 +366,27 @@ if (!class_exists('DraftScheduler')) {
|
|
359 |
* sql query
|
360 |
*/
|
361 |
|
362 |
-
$intvSecs = ($intvHours * 60 * 60) + ($intvMins * 60);
|
363 |
|
364 |
$findDrafts = "SELECT * FROM " .$wpdb->posts . " WHERE post_status = 'draft' AND post_type = 'post' ORDER BY rand()";
|
365 |
|
366 |
-
$draftList = $wpdb->get_results($findDrafts);
|
367 |
|
368 |
$this->draftScheduler_add_undo( $draftList );
|
369 |
|
370 |
-
if ( empty($draftList) ) {
|
371 |
return "No drafts were found";
|
372 |
}
|
373 |
|
374 |
$startDate = $startDate;
|
375 |
|
376 |
-
$ds_postDate = strtotime($startDate);
|
377 |
|
378 |
-
foreach ($draftList as $thisDraft){
|
379 |
|
380 |
$this->update_post_details( $ds_postDate, $thisDraft->ID );
|
381 |
$whole_post = get_post( $thisDraft->ID );
|
382 |
-
wp_transition_post_status( 'draft', 'future', $whole_post);
|
383 |
check_and_publish_future_post( $thisDraft->ID );
|
384 |
|
385 |
$ds_postDate += $intvSecs;
|
@@ -399,23 +406,23 @@ if (!class_exists('DraftScheduler')) {
|
|
399 |
* $intvSecs, convert hours and minutes to seconds for the
|
400 |
* sql query
|
401 |
*/
|
402 |
-
$intvSecs = ($intvHours * 60 * 60) + ($intvMins * 60);
|
403 |
|
404 |
$findDrafts = "SELECT ID FROM " .$wpdb->posts . " WHERE post_status = 'draft' AND post_type = 'post' ORDER BY id ASC";
|
405 |
|
406 |
-
$draftList = $wpdb->get_results($findDrafts);
|
407 |
$this->draftScheduler_add_undo( $draftList );
|
408 |
if ( empty( $draftList ) ) {
|
409 |
return "No drafts were found";
|
410 |
}
|
411 |
|
412 |
-
$ds_postDate = strtotime($startDate);
|
413 |
|
414 |
-
foreach ($draftList as $thisDraft){
|
415 |
|
416 |
$this->update_post_details( $ds_postDate, $thisDraft->ID );
|
417 |
$whole_post = get_post( $thisDraft->ID );
|
418 |
-
wp_transition_post_status( 'draft', 'future', $whole_post);
|
419 |
check_and_publish_future_post( $thisDraft->ID );
|
420 |
|
421 |
$ds_postDate += $intvSecs;
|
@@ -426,11 +433,11 @@ if (!class_exists('DraftScheduler')) {
|
|
426 |
|
427 |
function update_post_details( $ds_postDate, $draftID ){
|
428 |
global $wpdb;
|
429 |
-
$ds_gmt = get_gmt_from_date(date('Y-n-j G:i:s', $ds_postDate));
|
430 |
|
431 |
$update_date = array(
|
432 |
'ID' => $draftID,
|
433 |
-
'post_date' => date_i18n('Y-n-j G:i:s', $ds_postDate),
|
434 |
'post_date_gmt' => $ds_gmt,
|
435 |
'post_status' => 'future',
|
436 |
'edit_date' => true
|
@@ -467,7 +474,7 @@ if (!class_exists('DraftScheduler')) {
|
|
467 |
|
468 |
function draftScheduler_add_undo( $draftList ){
|
469 |
if ( is_array( $draftList ) ){
|
470 |
-
foreach ($draftList as $draft){
|
471 |
$undoList[] = $draft->ID;
|
472 |
}
|
473 |
update_option( $this->ifds_option, $undoList );
|
@@ -479,7 +486,7 @@ if (!class_exists('DraftScheduler')) {
|
|
479 |
|
480 |
$findDrafts = "SELECT COUNT(ID) FROM " .$wpdb->prefix . "posts WHERE post_status = 'draft' AND post_type = 'post'";
|
481 |
|
482 |
-
$draftCount = $wpdb->get_var($findDrafts);
|
483 |
|
484 |
return $draftCount;
|
485 |
}
|
2 |
/*
|
3 |
Plugin Name: Drafts Scheduler
|
4 |
Plugin URI: http://www.installedforyou.com/draftscheduler
|
5 |
+
Contributors: talus, beezeee
|
6 |
Description: Allows WordPress admins to bulk schedule posts currently saved as drafts
|
7 |
Author: Jeff Rose
|
8 |
+
Version: 1.7
|
9 |
Author URI: http://www.installedforyou.com
|
10 |
+
Tags: drafts, schedule, posts
|
11 |
+
License: GPL2
|
12 |
|
13 |
*/
|
14 |
|
43 |
* Primarily connects the WP hooks
|
44 |
*/
|
45 |
function DraftScheduler() {
|
|
|
46 |
|
47 |
add_action('admin_menu', array(&$this,'draftScheduler_Admin'));
|
48 |
}
|
49 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
50 |
/*
|
51 |
* function draftScheduler_Admin
|
52 |
* Sets up the Admin page for the user to schedule draft posts
|
53 |
*/
|
54 |
function draftScheduler_Admin() {
|
55 |
add_posts_page('Draft Scheduler', 'Draft Scheduler', 'administrator', 'draft_scheduler', array(&$this, 'draftScheduler_manage_page'));
|
|
|
56 |
}
|
57 |
|
58 |
/*
|
106 |
$msg = "Posts un-scheduled.";
|
107 |
}
|
108 |
|
109 |
+
if ( !empty( $_POST ) && $_POST["action"] !="undo" && check_admin_referer( 'do-schedule-drafts' ) ) {
|
110 |
$msg = '';
|
111 |
+
if ( !$_POST["action"] == "schedule_drafts" ) {
|
112 |
/*
|
113 |
* No action set, so just return
|
114 |
*/
|
115 |
return $msg;
|
116 |
} else {
|
117 |
+
if ( !j_is_date( $_POST['startDate'] ) ) {
|
118 |
$msg = 'Please enter a valid date to start posting';
|
119 |
return $msg;
|
120 |
}
|
122 |
$startDate = $_POST['startDate'];
|
123 |
$startTime = $_POST['startTime'];
|
124 |
$endTime = $_POST['endTime'];
|
125 |
+
$dayweekmonth = $_POST['dayweekmonth'];
|
126 |
|
127 |
$dailyMax = $_POST['postsperday'];
|
128 |
$exactPosts = $_POST['exactPosts'];
|
130 |
$intHours = $_POST['intHours'];
|
131 |
$intMins = $_POST['intMins'];
|
132 |
|
133 |
+
if ( $_POST['randomness'] == "sequential" || $_POST['randomness'] == "random" ) {
|
134 |
if ( !is_numeric( $intHours ) || ( $intHours =='' ) || ( 24 < $intHours ) || (0 > $intHours ) ) {
|
135 |
$msg = 'Please enter a valid Post Interval';
|
136 |
return $msg;
|
150 |
return $msg;
|
151 |
}
|
152 |
|
153 |
+
if ( strtotime( $startTime ) > strtotime( $endTime ) ) {
|
154 |
$msg = 'Ensure the start time is before the end time.';
|
155 |
return $msg;
|
156 |
}
|
157 |
}
|
158 |
|
159 |
+
if ( $_POST['randomness'] == "sequential" ){
|
160 |
|
161 |
+
$msg = $this->draftScheduler_sequential_post_by_interval( $startDate, $intHours, $intMins );
|
162 |
|
163 |
+
} else if ( $_POST['randomness'] == "random" ) {
|
164 |
|
165 |
+
$msg = $this->draftScheduler_random_post_by_interval( $startDate, $intHours, $intMins );
|
166 |
|
167 |
} else {
|
168 |
|
169 |
+
$msg = $this->draftScheduler_randomize_drafts( $startDate, $startTime, $endTime, $dailyMax, $exactPosts, $dayweekmonth );
|
170 |
}
|
171 |
|
172 |
return $msg;
|
218 |
<th scope="row">Schedule Start Date</th>
|
219 |
<td>
|
220 |
<div id="datepicker"></div>
|
221 |
+
<input type="text" name="startDate" id="startDate" size="31" value="<?php if( isset( $_POST['startDate'] ) ) echo $_POST['startDate']; ?>" />
|
222 |
<br />
|
223 |
Note: if you schedule starts "Today" then posting will start from midnight, including before "now."<br />You may wish to start tomorrow.
|
224 |
</td>
|
246 |
<th scope="row">Post Randomly</th>
|
247 |
<td>
|
248 |
<input type="radio" name="randomness" value="fullrandom" <?php if ($_POST['randomness'] == "fullrandom") echo " checked " ?>> Surprise me <em>(posts entirely randomly after the date above, but within the times below)</em><br />
|
249 |
+
Post up to <input type="text" name="postsperday" id="postsperda" value="<?php echo $_POST['postsperday']; ?>" size="3" maxlength="3" /> posts per
|
250 |
+
<select name="dayweekmonth">
|
251 |
+
<option value="day">day</option>
|
252 |
+
<option value="week">week</option>
|
253 |
+
<option value="month">month</option>
|
254 |
+
</select> <strong>OR</strong>
|
255 |
Post exactly <input type="text" name="exactPosts" id="exactPosts" value="<?php echo $_POST['exactPosts']; ?>" size="3" maxlength="3" /> posts per day<br />
|
256 |
Randomly after:
|
257 |
<select name="startTime" id="startTime">
|
284 |
* function draftScheduler_randomize_drafts
|
285 |
*
|
286 |
*/
|
287 |
+
function draftScheduler_randomize_drafts($startDate, $startTime, $endTime, $dailyMax = "", $exactPosts = "", $dayweekmonth ) {
|
288 |
|
289 |
global $wpdb;
|
290 |
|
294 |
$postsToday = $exactPosts;
|
295 |
}
|
296 |
|
297 |
+
$startPosts = date_i18n( 'Y-n-j G:i:s', strtotime($startDate . ' ' . $startTime));
|
298 |
|
299 |
$randInterval = (strtotime($endTime) - strtotime($startTime));
|
300 |
|
311 |
$finished = false;
|
312 |
|
313 |
while ( ! $finished ):
|
314 |
+
if ( $dayweekmonth == 'month' ) {
|
315 |
+
$weekSplit = floor( 30/$dailyMax );
|
316 |
+
$weightedAdd = rand( 0, 3 );
|
317 |
+
if ( $weightedAdd != 3 ) $weekSplit = $weekSplit + $weightedAdd;
|
318 |
+
$weekSplit <= 1 ? $incrementDays = '+1 day' : $incrementDays = "+$weekSplit days";
|
319 |
+
$startPosts = date_i18n( 'Y-n-j G:i:s', strtotime( $incrementDays, strtotime( $startPosts ) ) );
|
320 |
+
} elseif ($dayweekmonth == 'week') {
|
321 |
+
$weekSplit = floor( 7/$dailyMax );
|
322 |
+
$weekSplit = $weekSplit + rand( 0, 1 );
|
323 |
+
$weekSplit <= 1 ? $incrementDays = '+1 day' : $incrementDays = "+$weekSplit days";
|
324 |
+
$startPosts = date_i18n( 'Y-n-j G:i:s', strtotime( $incrementDays, strtotime( $startPosts ) ) );
|
325 |
+
} else {
|
326 |
+
if ( 0 >= $postsToday ){
|
327 |
+
if ( "" <> $dailyMax ){
|
328 |
+
$postsToday = rand( 0, $dailyMax * 100 ) / 100;
|
329 |
+
$startPosts = date_i18n( 'Y-n-j G:i:s', strtotime( "+1 day", strtotime( $startPosts ) ) );
|
330 |
+
} else {
|
331 |
+
$postsToday = $exactPosts;
|
332 |
+
$startPosts = date_i18n( 'Y-n-j G:i:s', strtotime( "+1 day", strtotime( $startPosts ) ) );
|
333 |
+
}
|
334 |
+
}
|
335 |
+
}
|
336 |
|
337 |
$thisDraft = array_pop( $draftList );
|
338 |
|
339 |
$postRandom = rand( 0, $randInterval );
|
340 |
+
$postTime = date_i18n( 'Y-n-j G:i:s', strtotime( "+" . $postRandom . " seconds", strtotime( $startPosts ) ) );
|
341 |
|
342 |
+
$this->update_post_details( strtotime( $postTime ), $thisDraft->ID );
|
343 |
$whole_post = get_post( $thisDraft->ID );
|
344 |
+
wp_transition_post_status( 'draft', 'future', $whole_post );
|
345 |
check_and_publish_future_post( $thisDraft->ID );
|
346 |
|
347 |
+
if ( 0 == count( $draftList ) ){
|
348 |
$finished = true;
|
349 |
}
|
350 |
$postsToday --;
|
366 |
* sql query
|
367 |
*/
|
368 |
|
369 |
+
$intvSecs = ( $intvHours * 60 * 60 ) + ( $intvMins * 60 );
|
370 |
|
371 |
$findDrafts = "SELECT * FROM " .$wpdb->posts . " WHERE post_status = 'draft' AND post_type = 'post' ORDER BY rand()";
|
372 |
|
373 |
+
$draftList = $wpdb->get_results( $findDrafts );
|
374 |
|
375 |
$this->draftScheduler_add_undo( $draftList );
|
376 |
|
377 |
+
if ( empty( $draftList ) ) {
|
378 |
return "No drafts were found";
|
379 |
}
|
380 |
|
381 |
$startDate = $startDate;
|
382 |
|
383 |
+
$ds_postDate = strtotime( $startDate );
|
384 |
|
385 |
+
foreach ( $draftList as $thisDraft ){
|
386 |
|
387 |
$this->update_post_details( $ds_postDate, $thisDraft->ID );
|
388 |
$whole_post = get_post( $thisDraft->ID );
|
389 |
+
wp_transition_post_status( 'draft', 'future', $whole_post );
|
390 |
check_and_publish_future_post( $thisDraft->ID );
|
391 |
|
392 |
$ds_postDate += $intvSecs;
|
406 |
* $intvSecs, convert hours and minutes to seconds for the
|
407 |
* sql query
|
408 |
*/
|
409 |
+
$intvSecs = ( $intvHours * 60 * 60 ) + ( $intvMins * 60 );
|
410 |
|
411 |
$findDrafts = "SELECT ID FROM " .$wpdb->posts . " WHERE post_status = 'draft' AND post_type = 'post' ORDER BY id ASC";
|
412 |
|
413 |
+
$draftList = $wpdb->get_results( $findDrafts );
|
414 |
$this->draftScheduler_add_undo( $draftList );
|
415 |
if ( empty( $draftList ) ) {
|
416 |
return "No drafts were found";
|
417 |
}
|
418 |
|
419 |
+
$ds_postDate = strtotime( $startDate );
|
420 |
|
421 |
+
foreach ( $draftList as $thisDraft ){
|
422 |
|
423 |
$this->update_post_details( $ds_postDate, $thisDraft->ID );
|
424 |
$whole_post = get_post( $thisDraft->ID );
|
425 |
+
wp_transition_post_status( 'draft', 'future', $whole_post );
|
426 |
check_and_publish_future_post( $thisDraft->ID );
|
427 |
|
428 |
$ds_postDate += $intvSecs;
|
433 |
|
434 |
function update_post_details( $ds_postDate, $draftID ){
|
435 |
global $wpdb;
|
436 |
+
$ds_gmt = get_gmt_from_date( date( 'Y-n-j G:i:s', $ds_postDate ) );
|
437 |
|
438 |
$update_date = array(
|
439 |
'ID' => $draftID,
|
440 |
+
'post_date' => date_i18n( 'Y-n-j G:i:s', $ds_postDate ),
|
441 |
'post_date_gmt' => $ds_gmt,
|
442 |
'post_status' => 'future',
|
443 |
'edit_date' => true
|
474 |
|
475 |
function draftScheduler_add_undo( $draftList ){
|
476 |
if ( is_array( $draftList ) ){
|
477 |
+
foreach ( $draftList as $draft ){
|
478 |
$undoList[] = $draft->ID;
|
479 |
}
|
480 |
update_option( $this->ifds_option, $undoList );
|
486 |
|
487 |
$findDrafts = "SELECT COUNT(ID) FROM " .$wpdb->prefix . "posts WHERE post_status = 'draft' AND post_type = 'post'";
|
488 |
|
489 |
+
$draftCount = $wpdb->get_var( $findDrafts );
|
490 |
|
491 |
return $draftCount;
|
492 |
}
|
readme.txt
CHANGED
@@ -3,12 +3,14 @@ Contributors: talus
|
|
3 |
Donate link: http://www.installedforyou.com/wordpress/drafts-scheduler-plugin/
|
4 |
Tags: drafts, scheduling, posts, schedule
|
5 |
Requires at least: 2.8
|
6 |
-
Tested up to: 3.
|
7 |
-
Stable tag: 1.
|
8 |
|
9 |
Sequentially or randomly schedule ALL draft posts for posting.
|
10 |
|
11 |
== Description ==
|
|
|
|
|
12 |
Ever imported or written a whole bunch of posts in draft status, then realized you needed to post them all over time?
|
13 |
|
14 |
If you've tried to do this manually, you know it takes a LONG time even using the Quick Edit.
|
@@ -24,8 +26,9 @@ Usage:
|
|
24 |
* All options also allow you to choose the start date. See Screenshots.
|
25 |
* Click Schedule Drafts and ALL posts withe status DRAFT will be scheduled.
|
26 |
* Now allows "UNDO" of most recent schedule for any non-published posts.
|
|
|
27 |
|
28 |
-
NB: I've said it before - ALL drafts will be scheduled,
|
29 |
|
30 |
== Installation ==
|
31 |
|
@@ -43,6 +46,10 @@ It was suggested I move this to the POSTS sub-menu as it makes sense in there. N
|
|
43 |
|
44 |
Sorry, not in this version. In the future, it would be easy to add.
|
45 |
|
|
|
|
|
|
|
|
|
46 |
= Ok, can I set drafts to a status other than Future? =
|
47 |
|
48 |
Again, sorry, not in this version. In the future, it would be easy to add.
|
@@ -51,6 +58,13 @@ Again, sorry, not in this version. In the future, it would be easy to add.
|
|
51 |
|
52 |
|
53 |
== Changelog ==
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
54 |
= 1.5 =
|
55 |
- Fixes for the problem where drafts publish immediately in WordPress 3.1.1
|
56 |
- Only update POST type posts, not pages - ALSO THIS WON'T POST any of the custom post types
|
3 |
Donate link: http://www.installedforyou.com/wordpress/drafts-scheduler-plugin/
|
4 |
Tags: drafts, scheduling, posts, schedule
|
5 |
Requires at least: 2.8
|
6 |
+
Tested up to: 3.3
|
7 |
+
Stable tag: 1.7
|
8 |
|
9 |
Sequentially or randomly schedule ALL draft posts for posting.
|
10 |
|
11 |
== Description ==
|
12 |
+
Last updated to 1.7 on Jan 2, 2012. Ignore the date on the right.
|
13 |
+
|
14 |
Ever imported or written a whole bunch of posts in draft status, then realized you needed to post them all over time?
|
15 |
|
16 |
If you've tried to do this manually, you know it takes a LONG time even using the Quick Edit.
|
26 |
* All options also allow you to choose the start date. See Screenshots.
|
27 |
* Click Schedule Drafts and ALL posts withe status DRAFT will be scheduled.
|
28 |
* Now allows "UNDO" of most recent schedule for any non-published posts.
|
29 |
+
* New - Choose the number of random posts per DAY, per WEEK or per MONTH! Thanks to Brian Zeligson for contributing this code.
|
30 |
|
31 |
+
NB: I've said it before - ALL drafts will be scheduled, but there is now an undo option.
|
32 |
|
33 |
== Installation ==
|
34 |
|
46 |
|
47 |
Sorry, not in this version. In the future, it would be easy to add.
|
48 |
|
49 |
+
= Can I schedule posts in my Custom Post Type? =
|
50 |
+
|
51 |
+
Sorry, not in this version. In the future, it would be possible to add.
|
52 |
+
|
53 |
= Ok, can I set drafts to a status other than Future? =
|
54 |
|
55 |
Again, sorry, not in this version. In the future, it would be easy to add.
|
58 |
|
59 |
|
60 |
== Changelog ==
|
61 |
+
= 1.7 =
|
62 |
+
- Fixed the bug where random posts where only posting in the AM.
|
63 |
+
|
64 |
+
= 1.6 =
|
65 |
+
- Added Brian Zeligson's code contribution allowing randomly posting a number of posts per WEEK or per MONTH instead of just per DAY.
|
66 |
+
- Minor code cleanup
|
67 |
+
|
68 |
= 1.5 =
|
69 |
- Fixes for the problem where drafts publish immediately in WordPress 3.1.1
|
70 |
- Only update POST type posts, not pages - ALSO THIS WON'T POST any of the custom post types
|