diff --git a/TODO b/TODO
index 0829eaf..da54b46 100644
--- a/TODO
+++ b/TODO
@@ -21,6 +21,7 @@
-Give user a visual representation that emails were actually sent.
--This wont work on save_post action because it redirects right after. Need to show message after page refresh.
+---Pro feature
-Only show metabox if product is downloadable
--Fixed (as of v1.1.2)
@@ -28,6 +29,22 @@
-Go to schedule mail set up and if no active cron schedule set then after setting the default to daily, update the option so the settings page could get the correct value
--Fixed (as of v1.1.2)
+-Show how many scheduled emails in queue
+--Fixed (as of v1.1.5)
+
+-Add styling for activated deactivated
+--Fixed (as of v1.1.5)
+
+-Edit read me FAQ to say HTML emails already in Pro version
+--Fixed (as of v1.1.5)
+
+-Add WooCommerce active check just like in pro versionn
+--Fixed (as of v1.1.5)
+
+-Add easy review heartbeat same as in Pro version.
+--Fixed (as of v1.1.5)
+
+
-In query when checking for emails to add to the custom table, also check for download remaining not = 0
-Show number of scheduled mail in queue on settings page.
@@ -40,3 +57,7 @@
--ongoing
-Check value option names
+
+-Add option to send all schedule emails
+
+-Test what happens if both pro and lite plugin activated.
diff --git a/assets/css/style.css b/assets/css/style.css
index 5832a1c..c5ffe6c 100644
--- a/assets/css/style.css
+++ b/assets/css/style.css
@@ -44,6 +44,10 @@ div#tld_wcdpue_metabox h2{
margin-bottom: 15px;
}
+#tld-wcdpue-upgrade{
+ margin-top: 10px;
+}
+
.tld-wcdpue-center-text{ text-align: center; }
.tld-wcdpue-top-margin{ margin-top: 10px; }
diff --git a/assets/js/tld-scripts.js b/assets/js/tld-scripts.js
index b0bf7f0..74017f6 100644
--- a/assets/js/tld-scripts.js
+++ b/assets/js/tld-scripts.js
@@ -46,11 +46,14 @@ function tld_cookie_business() {
if (tldCookie == null) {
document.cookie = "tld-wcdpue-cookie = tld-switch-cookie"
- //console.log('cookie created')
+ document.getElementById( "meta-switch-label" ).style.cssText="color: #228B22; font-weight: bold; ";
+ document.getElementById( "meta-switch-label" ).innerHTML = "Activated"
} else {
document.cookie = "tld-wcdpue-cookie = tld-switch-cookie; expires=Thu, 01 Jan 1970 00:00:00 UTC"
-
+ document.getElementById( "meta-switch-label" ).style.cssText="color: inherit; font-weight: normal; ";
+ document.getElementById( "meta-switch-label" ).innerHTML = "Deactivated"
+
}
}
diff --git a/includes/admin/tld-notice.php b/includes/admin/tld-notice.php
new file mode 100644
index 0000000..e15021b
--- /dev/null
+++ b/includes/admin/tld-notice.php
@@ -0,0 +1,117 @@
+ID;
+ // Get today's timestamp.
+ $today = mktime( 0, 0, 0, date('m') , date('d'), date('Y') );
+ // Get the trigger date
+ $tld_wcdpue_triggerdate = get_option( 'tld_wcdpue_activation_date', false );
+ $installed = ( ! empty( $tld_wcdpue_triggerdate ) ? $tld_wcdpue_triggerdate : '999999999999999' );
+ // First check whether today's date is greater than the install date plus the delay
+ // Then check whether the use is a Super Admin or Admin on a non-Multisite Network
+ // For testing live, remove `$installed <= $today &&` from this conditional
+
+ if ( $installed <= $today && danp_is_super_admin_admin( $current_user = $current_user ) == true ) {
+ // Make sure we're on the plugins page.
+ if ( 'plugins.php' == $pagenow ) {
+ // If the user hasn't already dismissed our alert,
+ // Output the activation banner.
+ $nag_admin_dismiss_url = 'plugins.php?tld_wcdpue_review_dismiss=0';
+ $user_meta = get_user_meta( $user_id, 'tld_wcdpue_review_dismiss' );
+
+ if ( empty( $user_meta ) ) {
+ ?>
+
+
+
+
+
' . $plugin_name . ' is helping you better manage your store. Would you please consider rating this plugin? 5 stars would be nice :)', 'wcdpue-pro' ), esc_url( $review_url ) ), array( 'strong' => array(), 'a' => array( 'href' => array(), 'target' => array() ) ) ); ?>
+
+
-}
-function tld_wcdpue_update_schedule() {
+ $value ) {
+ //register our settings
+ register_setting( 'tld-wcdpue-settings-group', 'tld-wcdpue-email-subject' );
+ register_setting( 'tld-wcdpue-settings-group', 'tld-wcdpue-email-body' );
+ register_setting( 'tld-wcdpue-settings-group', 'tld-wcdpue-email-footer' );
+ register_setting( 'tld-wcdpue-settings-group', 'tld-wcdpue-email-bursts-count' );
+ register_setting( 'tld-wcdpue-settings-group', 'tld-wcdpue-schedule-setting-value' );
+ register_setting( 'tld-wcdpue-settings-group', 'tld-wcdpue-delete-db-settings' );
- if ( $key == $tld_wcdpue_cur_recurrence ){
+ }
- $tld_wcdpue_wait_time = $value['interval'];
+ function tld_wcdpue_update_schedule() {
- }
+ $tld_wcdpue_cur_recurrence = get_option( 'tld-wcdpue-schedule-setting-value' ); //get interval set by user
+ $tld_wcdpue_active_cron_schedules = wp_get_schedules();
- }
- wp_clear_scheduled_hook('tld_wcdpue_email_burst'); //remove previous scheduled time
- wp_schedule_event( time() + $tld_wcdpue_wait_time , $tld_wcdpue_cur_recurrence, 'tld_wcdpue_email_burst' ); //add new scheduled time
+ foreach ( $tld_wcdpue_active_cron_schedules as $key => $value ) {
-}
-add_action( 'update_option_tld-wcdpue-schedule-setting-value', 'tld_wcdpue_update_schedule');
+ if ( $key == $tld_wcdpue_cur_recurrence ){
+
+ $tld_wcdpue_wait_time = $value['interval'];
+
+ }
+
+ }
+ wp_clear_scheduled_hook('tld_wcdpue_email_burst'); //remove previous scheduled time
+ wp_schedule_event( time() + $tld_wcdpue_wait_time , $tld_wcdpue_cur_recurrence, 'tld_wcdpue_email_burst' ); //add new scheduled time
+
+ }
+ add_action( 'update_option_tld-wcdpue-schedule-setting-value', 'tld_wcdpue_update_schedule');
-?>
+ ?>
diff --git a/readme.txt b/readme.txt
index cfac651..ede900b 100644
--- a/readme.txt
+++ b/readme.txt
@@ -1,19 +1,26 @@
=== Plugin Name ===
Contributors: uriahs-victor
-Plugin Name: TLD WooCommerce Downloadable Product Update Emails
+Plugin Name: WooCommerce Downloadable Product Update Emails
Plugin URI: https://github.com/UVLabs/WooCommerce-Downloadable-Product-Update-Emails
Tags: woocommerce, emails, downloadable, products, update, schedule, ecommerce, e-commerce, customers, ebook, email customers, software, music, videos, notify customers
Author URI: http://uriahsvictor.com
Author: Uriahs Victor
Requires at least: 4.1
-Tested up to: 4.6.1
-Stable tag: 1.1.3
-Version: 1.1.3
+Tested up to: 4.7
+Stable tag: 1.1.5
+Version: 1.1.5
License: GPLv2 of later
== Description ==
-A simple plugin used to send emails to customers who bought a downloadable product, letting them know that there's been an update to their download. Never let customers guess if an edition of the e-book they bought has been updated. No more need to manually email customers about downloadable product updates or creating a new product.
+WooCommerce Downloadable Product Update Emails. This plugin can be used to send emails to customers who bought a WooCommerce downloadable product, letting them know that there's been an update to their download. Never let customers guess if an edition of the e-book they bought or other product they bought has been updated. No more need to manually email customers about downloadable product updates or creating a new product.
+
+
+= Pro Version =
+
+Take a look at the Pro version for more functionality including HTML Emails, Variable Product Support and more!
+
+[Go to Pro plugin page.](https://codecanyon.net/item/woocommerce-downloadable-product-update-emails/18908283?ref=TheLoneDev)
== Installation ==
@@ -34,6 +41,19 @@ A simple plugin used to send emails to customers who bought a downloadable produ
== Changelog ==
+**1.1.5**
+
+* Output admin notice if WooCommerce not active.
+* Metabox text changes
+* Tested WP 4.7
+* Other minor changes
+
+**1.1.4**
+
+* Pro version now available.
+* Plugin name change.
+* Other minor changes.
+
**1.1.3**
* Fix changelog
@@ -74,7 +94,7 @@ I used wp_mail in the plugin so you could easily override the default send from
= HTML Email Templates? =
-Will be available in Pro version of plugin.
+Available in Pro version of plugin.
= What are Email Bursts? =
diff --git a/tld-wc-dl-product-update-emails.php b/tld-wc-dl-product-update-emails.php
index 94a03d9..5837e94 100644
--- a/tld-wc-dl-product-update-emails.php
+++ b/tld-wc-dl-product-update-emails.php
@@ -1,9 +1,9 @@
+
+
+
WooCommerce is not activated, please activate it to use WCDPUE Lite.
+
+ 900,
- 'display' => __( 'Every 15 Minutes' )
+ 'interval' => 60,
+ 'display' => __( 'Every 1 Minute' )
- );
- return $schedules;
+ );
+ return $schedules;
}
add_filter( 'cron_schedules', 'tld_wcdpue_cron_quarter_hour' );
function tld_wcdpue_metabox(){
- global $pagenow;
- $tld_wcdpue_the_product = wc_get_product( get_the_ID() );
- if ( $pagenow != 'post-new.php' && $tld_wcdpue_the_product->is_downloadable( 'yes' ) && ! $tld_wcdpue_the_product->is_type('variable') ){
- add_meta_box(
- 'tld_wcdpue_metabox',
- 'Email Options',
- 'tld_metabox_fields',
- '',
- 'side',
- 'high'
- );
+ global $pagenow;
+ $tld_wcdpue_the_product = wc_get_product( get_the_ID() );
+ if ( $pagenow != 'post-new.php' && $tld_wcdpue_the_product->is_downloadable( 'yes' ) ){
+ add_meta_box(
+ 'tld_wcdpue_metabox',
+ 'Email Options',
+ 'tld_metabox_fields',
+ '',
+ 'side',
+ 'high'
+ );
-}
+ }
}
add_action('add_meta_boxes_product', 'tld_wcdpue_metabox', 10, 2);
function tld_get_product_owners(){
- global $wpdb;
- $tld_wcdpue_product_id = get_the_ID();
- $tld_wcdpue_tbl_prefix = $wpdb->prefix;
- $tld_wcdpue_dls_table = $tld_wcdpue_tbl_prefix . 'woocommerce_downloadable_product_permissions';
- // try making above global to use in save posts event
- $query_result = $wpdb->get_var(
- "SELECT COUNT(*)
- FROM $tld_wcdpue_dls_table
- WHERE ( product_id = $tld_wcdpue_product_id )
- AND (access_expires > NOW() OR access_expires IS NULL )
- ");
- echo $query_result;
+ global $wpdb;
+ $tld_wcdpue_product_id = get_the_ID();
+ $tld_wcdpue_tbl_prefix = $wpdb->prefix;
+ $tld_wcdpue_dls_table = $tld_wcdpue_tbl_prefix . 'woocommerce_downloadable_product_permissions';
+ // try making above global to use in save posts event
+ $query_result = $wpdb->get_var(
+ "SELECT COUNT(*)
+ FROM $tld_wcdpue_dls_table
+ WHERE ( product_id = $tld_wcdpue_product_id )
+ AND (access_expires > NOW() OR access_expires IS NULL )
+ ");
+ echo $query_result;
-}
+ }
-function tld_metabox_fields(){
+ function tld_metabox_fields(){
+ $tld_wcdpue_product_id = get_the_ID();
+ $tld_wcdpue_product = wc_get_product( $tld_wcdpue_product_id );
+ ?>
- ?>
+