diff --git a/README.md b/README.md
index 3df8248..e2cf5f8 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,6 @@
# Draft Concluder
-Based on [an idea by John Blackbourn](https://twitter.com/johnbillion/status/1314494422529331203), this plugin is designed to be a reminder to those who leave draft posts unloved. And, yes, all of John's ideas are here, with more to boot.
+Based on [an idea by John Blackbourn](https://twitter.com/johnbillion/status/1314494422529331203), this plugin is designed to be a reminder to those who leave draft posts unloved. And, yes, all of John's ideas are here, with more to boot.
* Send emails out on a daily or weekly schedule and at a time that you'd prefer
* Look for draft pages as well as posts, if you like. Or just pages, if that's what you want. We won't judge
@@ -14,6 +14,6 @@ Oh, and, naturally, the code passes [WordPress](https://github.com/WordPress/Wor
Always forgetting to complete posts or you have other people on your site who do? This is the draft botherer that you need!
-I'd like to thank [Caleb Burks](https://calebburks.com/) for the feedback he provided. Also, the iconography is courtesy of the very talented [Janki Rathod](https://www.linkedin.com/in/jankirathore/) ♥️
+I'd like to thank [Caleb Burks](https://calebburks.com/) for the feedback he provided. Also, the iconography is courtesy of the very talented [Janki Rathod](https://www.fiverr.com/jankirathore) ♥️
\ No newline at end of file
diff --git a/draft-concluder.php b/draft-concluder.php
index 0868985..de06022 100644
--- a/draft-concluder.php
+++ b/draft-concluder.php
@@ -1,14 +1,29 @@
';
if ( ! $output ) {
- echo esc_html( __( 'Draft Concluder has not yet run.', 'draft_concluder' ) );
+ $debug .= esc_html( __( 'Draft Concluder has not yet run.', 'draft_concluder' ) );
} else {
$timestamp = date( 'l jS \of F Y h:i:s A', $output['timestamp'] );
if ( 0 == $output['errors'] ) {
@@ -48,8 +48,8 @@ function draft_concluder_last_run_shortcode( $paras, $content ) {
/* translators: %1$s: timestamp %2$s: number of errors */
$text = sprintf( __( 'Draft Concluder last ran at %1$s, with %2$s errors.', 'draft_concluder' ), esc_html( $timestamp ), esc_html( $output['errors'] ) );
}
- echo esc_html( $text ) . ' ';
- echo wp_kses(
+ $debug .= esc_html( $text ) . ' ';
+ $debug .= wp_kses(
$output['emails'],
array(
'br' => array(),
@@ -57,7 +57,8 @@ function draft_concluder_last_run_shortcode( $paras, $content ) {
)
);
}
- echo '';
+
+ return $debug;
}
add_shortcode( 'dc_last_run', 'draft_concluder_last_run_shortcode' );
diff --git a/inc/process-drafts.php b/inc/process-drafts.php
index 094ded4..f325b78 100644
--- a/inc/process-drafts.php
+++ b/inc/process-drafts.php
@@ -90,16 +90,24 @@ function draft_concluder_process_posts( $debug = false ) {
}
}
+ // If the modified date is different to the creation date, then we'll output it.
+ // In which case, we'll build an appropriate end-of-sentence.
+ $modified = '';
+ if ( $post->post_date != $post->post_modified ) {
+ /* translators: %1$s: the date the post was last modified */
+ $modified = sprintf( __( ' and last edited on %1$s', 'draft_concluder' ), esc_html( substr( $post->post_modified, 0, strlen( $post->post_modified ) - 3 ) ) );
+ }
+
if ( $include_draft ) {
// Build a list of drafts that require the user's attention.
-
$draft_count ++;
/* translators: Do not translate COUNT,TITLE, LINK, CREATED or MODIFIED : those are placeholders. */
$message .= __(
'###COUNT###. ###TITLE### - ###LINK###
- This was created on ###CREATED### and last edited on ###MODIFIED###.
+ This was created on ###CREATED######MODIFIED###.
+
',
'draft_concluder'
);
@@ -117,7 +125,7 @@ function draft_concluder_process_posts( $debug = false ) {
esc_html( $post->post_title ),
esc_html( get_admin_url() . 'post.php?post=' . $post->ID . '&action=edit' ),
esc_html( substr( $post->post_date, 0, strlen( $post->post_date ) - 3 ) ),
- esc_html( substr( $post->post_modified, 0, strlen( $post->post_modified ) - 3 ) ),
+ $modified,
),
$message
);
@@ -125,7 +133,6 @@ function draft_concluder_process_posts( $debug = false ) {
}
// Add a header to the email content. A different message is used dependant on whether there is 1 or more drafts.
-
if ( 0 < $draft_count ) {
if ( 1 == $draft_count ) {
@@ -180,7 +187,7 @@ function draft_concluder_process_posts( $debug = false ) {
// If debugging, output to screen - otherwise, email the results.
if ( $debug ) {
- echo wp_kses(
+ return wp_kses(
$display_out,
array(
'br' => array(),
diff --git a/inc/settings.php b/inc/settings.php
index 36bc3d1..0eea831 100644
--- a/inc/settings.php
+++ b/inc/settings.php
@@ -51,12 +51,13 @@ function draft_concluder_section_callback() {
echo esc_html( __( 'These settings allow you to control when the emails are generated and what they should report on.', 'draft-concluder' ) );
+ // Show the current status of the event run.
echo '
';
echo wp_kses( '' . __( 'Status: ', 'draft_concluder' ) . '', array( 'strong' => array() ) );
if ( ! $output ) {
echo esc_html( __( 'Draft Concluder has not yet run.', 'draft_concluder' ) );
} else {
- $timestamp = date( 'l jS \of F Y @ h:i:s A', $output['timestamp'] );
+ $timestamp = date( 'l jS \o\f F Y \a\t g:i A', $output['timestamp'] );
if ( 0 == $output['errors'] ) {
/* translators: %1$s: timestamp */
$text = sprintf( __( 'Draft Concluder last ran at %1$s, successfully.', 'draft_concluder' ), $timestamp );
@@ -66,6 +67,13 @@ function draft_concluder_section_callback() {
}
}
+ // If an event has been scheduled, output the next run time.
+ if ( false !== wp_next_scheduled( 'draft_concluder_mailer' ) ) {
+ $next_run = date( 'l jS \o\f F Y \a\t g:i A', wp_next_scheduled( 'draft_concluder_mailer' ) );
+ /* translators: %1$s: timestamp */
+ $text .= ' ' . sprintf( __( 'It is next due to run on %1$s.', 'draft_concluder' ), $next_run );
+ }
+
echo esc_html( $text ) . ' ';
}
@@ -77,40 +85,20 @@ function draft_concluder_section_callback() {
function draft_concluder_when_callback() {
$option = get_option( 'draft_concluder_when' );
-
- echo '';
+ if ( ! $option ) {
+ $option = 'Monday';
+ }
+
+ echo '';
}
/**
@@ -121,40 +109,36 @@ function draft_concluder_when_callback() {
function draft_concluder_time_callback() {
$option = get_option( 'draft_concluder_time' );
-
- echo '';
+ if ( ! $option ) {
+ $option = '1am';
+ }
+
+ echo '';
}
/**
@@ -165,20 +149,15 @@ function draft_concluder_time_callback() {
function draft_concluder_what_callback() {
$option = get_option( 'draft_concluder_what' );
-
- echo '';
+
+ echo '';
}
/**
@@ -193,7 +172,7 @@ function draft_concluder_age_callback() {
$option = 0;
}
- echo ' days';
+ echo ' ' . esc_html__( 'days', 'draft_concluder' );
}
/**
@@ -204,14 +183,12 @@ function draft_concluder_age_callback() {
function draft_concluder_since_callback() {
$option = get_option( 'draft_concluder_since' );
-
- echo '';
+
+ echo '';
}
diff --git a/inc/setup.php b/inc/setup.php
index 1224279..d0f7cb8 100644
--- a/inc/setup.php
+++ b/inc/setup.php
@@ -71,9 +71,10 @@ function draft_concluder_action_links( $actions, $plugin_file ) {
*/
function draft_concluder_set_up_schedule() {
+ $day = 'tomorrow';
+
// Get the time that the event needs scheduling for.
// If one isn't specified, default to 1am!
-
$time = get_option( 'draft_concluder_time' );
if ( ! $time ) {
$time = '1am';
@@ -81,18 +82,19 @@ function draft_concluder_set_up_schedule() {
// If we have an old time saved, check to see if it's changed.
// If it has, remove the event and update the old one.
-
$saved_time = get_option( 'draft_concluder_prev_time' );
if ( ! $saved_time || $time != $saved_time ) {
+ if ( strtotime( 'today ' . $time ) > strtotime( 'now' ) ) {
+ $day = 'today';
+ }
wp_clear_scheduled_hook( 'draft_concluder_mailer' );
update_option( 'draft_concluder_prev_time', $time );
}
// Schedule an event if one doesn't already exist.
-
if ( ! wp_next_scheduled( 'draft_concluder_mailer' ) && ! wp_installing() ) {
- wp_schedule_event( strtotime( 'tomorrow ' . $time ), 'daily', 'draft_concluder_mailer' );
+ wp_schedule_event( strtotime( $day . ' ' . $time ), 'daily', 'draft_concluder_mailer' );
}
}
@@ -107,14 +109,12 @@ function draft_concluder_schedule_engine() {
// Grab the settings for how often to run this.
// If it's not been set, assume weekly!
-
$when = get_option( 'draft_concluder_when' );
if ( ! $when ) {
$when = 'Monday';
}
// Check to see if it should be run.
-
if ( 'Daily' == $when || ( 'Daily' != $when && date( 'l' ) == $when ) ) {
draft_concluder_process_posts();
}
diff --git a/readme.txt b/readme.txt
index eb390f1..2d39dac 100644
--- a/readme.txt
+++ b/readme.txt
@@ -1,11 +1,11 @@
=== Draft Concluder ===
Contributors: dartiss
Donate link: https://artiss.blog/donate
-Tags: drafts, email, mail, pages, posts, reminder
-Requires at least: 3.1
+Tags: drafts, email, pages, posts, reminder
+Requires at least: 4.6
Tested up to: 5.5
Requires PHP: 5.3
-Stable tag: 1.0.1
+Stable tag: 1.1
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
@@ -13,7 +13,7 @@ License URI: http://www.gnu.org/licenses/gpl-2.0.html
== Description ==
-Based on [an idea by John Blackbourn](https://twitter.com/johnbillion/status/1314494422529331203), this plugin is designed to be a reminder to those who leave draft posts unloved. And, yes, all of John's ideas are here, with more to boot.
+Based on [an idea by John Blackbourn](https://twitter.com/johnbillion/status/1314494422529331203), and mentioned by [Post Status](https://poststatus.com/), this plugin is designed to be a reminder to those who leave draft posts unloved. And, yes, all of John's ideas are here, with more to boot.
* Send emails out on a daily or weekly schedule and at a time that you'd prefer
* Look for draft pages as well as posts, if you like. Or just pages, if that's what you want. We won't judge
@@ -25,10 +25,16 @@ Based on [an idea by John Blackbourn](https://twitter.com/johnbillion/status/131
Oh, and, naturally, the code passes [WordPress](https://github.com/WordPress/WordPress-Coding-Standards) and [WordPress VIP](https://github.com/Automattic/VIP-Coding-Standards) coding standards 🎉
-I'd like to thank [Caleb Burks](https://calebburks.com/) for the feedback he provided. Also, the iconography is courtesy of the very talented [Janki Rathod](https://www.linkedin.com/in/jankirathore/) ♥️
+I'd like to thank [Caleb Burks](https://calebburks.com/) for the feedback he provided. Also, the iconography is courtesy of the very talented [Janki Rathod](https://www.fiverr.com/jankirathore) ♥️
👉 Please visit the [Github page](https://github.com/dartiss/draft-concluder "Github") for the latest code development, planned enhancements and known issues 👈
+== Mentions ==
+
+Draft Concluder was mentioned in issue 421 of [the Post Status newsletter](https://poststatus.com/newsletter/) (published 16th November 2020).
+
+It was also mentioned in [edition 21 of the WP Weekly newsletter](https://thewpweekly.com/21/) (published 23rd November 2020)
+
== Installation ==
Draft Concluder can be found and installed via the Plugin menu within WordPress administration (Plugins -> Add New). Alternatively, it can be downloaded from WordPress.org and installed manually...
@@ -86,7 +92,17 @@ And the deed is done - you can no longer disable the plugin (cue diabolical laug
== Changelog ==
-I use symantic versioning, with the first release being 1.0.
+I use semantic versioning, with the first release being 1.0.
+
+= 1.1 =
+* Enhancement: Making better use of `selected` command for my settings output (thanks to [Tom Nowell](https://tomjn.com/))
+* Enhancement: You can now choose any hour of the day for the email to be generated, not just select hours
+* Enhancement: Various improvements to plugin meta and this README
+* Enhancement: Improvements to email format (thanks to [Michelle Keefer](https://consultmk.com/))
+* Enhancement: When changing the hour that the email is generated, and you've chosen a daily run, it will be produced same day if the hour hasn't already passed
+* Enhancement: Added next run time to the settings output
+* Enhancement: Improved internationalization
+* Bug: Shortcodes now correctly output (thanks to [Tom Nowell](https://tomjn.com/))
= 1.0.1 =
* Bug: In what must be the quickest time from initial release to first bug report, thanks to [JeanPaulH](https://wordpress.org/support/users/djr/) for finding a stray comma!
@@ -96,5 +112,5 @@ I use symantic versioning, with the first release being 1.0.
== Upgrade Notice ==
-= 1.0.1 =
-* Bug fix
+= 1.1 =
+* Minor enhancements and some bug fixes. Basically, what you'd expect from someone stuck in COVID lockdown.