From f4905d7e77824a9c4f8266b517f2d6b81cfb7c3f Mon Sep 17 00:00:00 2001 From: TheLoneDeveloper Date: Sat, 26 Nov 2016 19:26:11 -0400 Subject: [PATCH 1/2] Add Pro notices --- TODO | 4 + assets/css/style.css | 4 + includes/admin/tld-settings-page.php | 307 ++++++++++++++------------- readme.txt | 15 +- tld-wc-dl-product-update-emails.php | 260 ++++++++++++----------- 5 files changed, 316 insertions(+), 274 deletions(-) diff --git a/TODO b/TODO index 0829eaf..6c4345f 100644 --- a/TODO +++ b/TODO @@ -40,3 +40,7 @@ --ongoing -Check value option names + +-Add option to send all schedule emails + +-Show how many scheduled emails in queue 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/includes/admin/tld-settings-page.php b/includes/admin/tld-settings-page.php index e2ce10b..e020718 100644 --- a/includes/admin/tld-settings-page.php +++ b/includes/admin/tld-settings-page.php @@ -12,185 +12,202 @@ function tld_wcdpue_add_admin_menu() { } -function tld_wcdpue_get_email_body(){ +function tld_wcdpue_get_queue(){ - $tld_wcdpue_email_body = esc_attr( get_option( 'tld-wcdpue-email-body' ) ); + global $wpdb; + $tld_wcdpue_tbl_prefix = $wpdb->prefix; + $tld_wcdpue_the_schedule_table = $tld_wcdpue_tbl_prefix . 'woocommerce_downloadable_product_emails_tld'; - if( !empty( $tld_wcdpue_email_body ) ){ - - echo $tld_wcdpue_email_body; + $tld_wcdpue_queue_count = $wpdb->get_var( + "SELECT COUNT(*) + FROM $tld_wcdpue_the_schedule_table + "); + echo $tld_wcdpue_queue_count; } -} + function tld_wcdpue_get_email_body(){ -function tld_wcdpue_get_email_footer(){ + $tld_wcdpue_email_body = esc_attr( get_option( 'tld-wcdpue-email-body' ) ); - $tld_wcdpue_email_footer = esc_attr( get_option('tld-wcdpue-email-footer') ); + if( !empty( $tld_wcdpue_email_body ) ){ - if( !empty( $tld_wcdpue_email_footer ) ){ + echo $tld_wcdpue_email_body; - echo $tld_wcdpue_email_footer; + } } -} + function tld_wcdpue_get_email_footer(){ -function tld_wcdpue_settings_page() { - //page html - ?> - -
-

Plugin Options

-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +

E-mail options

E-mail subject
E-mail Body - -
E-mail Footer - -

E-mail schedule options

Send e-mails in bursts of ( Keep this value below 5 to ensure deliverability. ): - -
Schedule: - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - -

E-mail options

E-mail subject
E-mail Body + +
E-mail Footer + +

E-mail schedule options

Send e-mails in bursts of ( Keep this value below 5 to ensure deliverability. ): + +
Schedule: + +
Emails in Queue:

Housekeeping

Delete all plugin settings on uninstall?

Housekeeping

Delete all plugin settings on uninstall?>
- - - - - - -
- -
-

Did my plugin help?

-
- -

If this plugin genuinely helped you with managing your store then maybe you might like to donate?

-
- - - - - - - - - - -
+
>
+ + +
-
+
-
- +
+

Did my plugin help?

+
+

If this plugin genuinely helped you with managing your store then maybe you might like to donate?

+
+ + + + + + + + + + +
- -function tld_wcdpue_settings() { +
- //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' ); +
+ -} -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..7863087 100644 --- a/readme.txt +++ b/readme.txt @@ -7,13 +7,16 @@ 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 +Stable tag: 1.1.4 +Version: 1.1.4 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. +This plugin can be 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. + +Check out the Pro Version! http://bit.ly/wcdpue-pro + == Installation == @@ -34,6 +37,12 @@ A simple plugin used to send emails to customers who bought a downloadable produ == Changelog == +**1.1.4** + +* Pro version now available. +* Plugin name change. +* Other minor changes. + **1.1.3** * Fix changelog diff --git a/tld-wc-dl-product-update-emails.php b/tld-wc-dl-product-update-emails.php index 94a03d9..257330f 100644 --- a/tld-wc-dl-product-update-emails.php +++ b/tld-wc-dl-product-update-emails.php @@ -1,9 +1,9 @@ 900, - 'display' => __( 'Every 15 Minutes' ) + 'interval' => 900, + 'display' => __( 'Every 15 Minutes' ) - ); - 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 ); + ?> - ?> +
-
+ -

Buyers with download access:

-
+ if( $tld_wcdpue_product->is_type( 'variable' ) ){ -
- -
+ echo '
Upgrade to Pro for variable downloadable product support!
'; -
-
-
+ }else{ + ?> +
+

Buyers with download access:

+
-
- Immediately - Schedule -
+
+ +
- +
+
+
- - clicking on "#tld-switch" toggles class "active" on "#tld-switch" - +
+ Immediately + Schedule +
- +
Upgrade to Pro
+ - + + clicking on "#tld-switch" toggles class "active" on "#tld-switch" + - -function tld_wcdpue_get_creds(){ - return 'Sent using WCDPUE: http://bit.ly/wcdpue'; -} + -function tld_wcdpue_post_saved( $post_id ) { + prefix; - $tld_wcdpue_dls_table = $tld_wcdpue_tbl_prefix . 'woocommerce_downloadable_product_permissions'; - $query_result = $wpdb->get_results( - "SELECT * - FROM $tld_wcdpue_dls_table - WHERE ( product_id = $post_id ) - AND (access_expires > NOW() OR access_expires IS NULL ) - " - ); + if( isset( $_COOKIE['tld-wcdpue-cookie'] ) ) { - //get our options + if ( wp_is_post_revision( $post_id ) || wp_is_post_autosave( $post_id ) ) + return; - $tld_wcdpue_email_subject = esc_attr( get_option( 'tld-wcdpue-email-subject' ) ); - $tld_wcdpue_email_body = esc_attr( get_option( 'tld-wcdpue-email-body' ) ); - $tld_wcdpue_email_footer = esc_attr( get_option( 'tld-wcdpue-email-footer' ) ); + global $wpdb; + $tld_wcdpue_tbl_prefix = $wpdb->prefix; + $tld_wcdpue_dls_table = $tld_wcdpue_tbl_prefix . 'woocommerce_downloadable_product_permissions'; + $query_result = $wpdb->get_results( + "SELECT * + FROM $tld_wcdpue_dls_table + WHERE ( product_id = $post_id ) + AND (access_expires > NOW() OR access_expires IS NULL ) + " + ); - if ( empty( $tld_wcdpue_email_subject ) ){ - $tld_wcdpue_email_subject = 'A product you bought has been updated!'; - } + //get our options - if ( empty( $tld_wcdpue_email_body ) ){ - $tld_wcdpue_email_body = 'There is a new update for your product:'; - } + $tld_wcdpue_email_subject = esc_attr( get_option( 'tld-wcdpue-email-subject' ) ); + $tld_wcdpue_email_body = esc_attr( get_option( 'tld-wcdpue-email-body' ) ); + $tld_wcdpue_email_footer = esc_attr( get_option( 'tld-wcdpue-email-footer' ) ); - if ( empty( $tld_wcdpue_email_footer ) ){ - $tld_wcdpue_email_footer = 'Log in to download it from your account now:'; - } + if ( empty( $tld_wcdpue_email_subject ) ){ + $tld_wcdpue_email_subject = 'A product you bought has been updated!'; + } - $tld_wcdpue_account_url = esc_url ( get_permalink( get_option( 'woocommerce_myaccount_page_id' ) ) ); + if ( empty( $tld_wcdpue_email_body ) ){ + $tld_wcdpue_email_body = 'There is a new update for your product:'; + } - $tld_wcdpue_option_selected = $_POST['tld-option-selected']; + if ( empty( $tld_wcdpue_email_footer ) ){ + $tld_wcdpue_email_footer = 'Log in to download it from your account now:'; + } - if ( $tld_wcdpue_option_selected == 'immediately' ){ + $tld_wcdpue_account_url = esc_url ( get_permalink( get_option( 'woocommerce_myaccount_page_id' ) ) ); - foreach ( $query_result as $tld_wcdpue_email_address ){ + $tld_wcdpue_option_selected = $_POST['tld-option-selected']; - $tld_wcdpue_post_title = get_the_title( $post_id ); - $tld_wcdpue_product_url = esc_url( get_permalink( $post_id ) ); - $tld_wcdpue_buyer_email_address = $tld_wcdpue_email_address->user_email; - $tld_wcdpue_email_subject = $tld_wcdpue_email_subject; - $tld_wcdpue_email_message = $tld_wcdpue_email_body . "\n\n"; - $tld_wcdpue_email_message .= $tld_wcdpue_post_title . ": " . $tld_wcdpue_product_url . "\n\n" . $tld_wcdpue_email_footer . "\n\n" . $tld_wcdpue_account_url /*. "\n\n\n" . apply_filters( 'tld_wcdpue_plugin_creds', tld_wcdpue_get_creds() )*/; - wp_mail( $tld_wcdpue_buyer_email_address, $tld_wcdpue_email_subject, $tld_wcdpue_email_message ); + if ( $tld_wcdpue_option_selected == 'immediately' ){ - } + foreach ( $query_result as $tld_wcdpue_email_address ){ - }else{ + $tld_wcdpue_post_title = get_the_title( $post_id ); + $tld_wcdpue_product_url = esc_url( get_permalink( $post_id ) ); + $tld_wcdpue_buyer_email_address = $tld_wcdpue_email_address->user_email; + $tld_wcdpue_email_subject = $tld_wcdpue_email_subject; + $tld_wcdpue_email_message = $tld_wcdpue_email_body . "\n\n"; + $tld_wcdpue_email_message .= $tld_wcdpue_post_title . ": " . $tld_wcdpue_product_url . "\n\n" . $tld_wcdpue_email_footer . "\n\n" . $tld_wcdpue_account_url; + wp_mail( $tld_wcdpue_buyer_email_address, $tld_wcdpue_email_subject, $tld_wcdpue_email_message ); - foreach ( $query_result as $tld_wcdpue_email_address ){ + } - $tld_wcdpue_buyer_email_address = $tld_wcdpue_email_address->user_email; - $tld_wcdpue_the_scheduling_table = $tld_wcdpue_tbl_prefix . 'woocommerce_downloadable_product_emails_tld'; - $wpdb->insert( - $tld_wcdpue_the_scheduling_table , - array( + }else{ - 'id' => '', - 'product_id' => $post_id, - 'user_email' => $tld_wcdpue_buyer_email_address, + foreach ( $query_result as $tld_wcdpue_email_address ){ - ) - ); + $tld_wcdpue_buyer_email_address = $tld_wcdpue_email_address->user_email; + $tld_wcdpue_the_scheduling_table = $tld_wcdpue_tbl_prefix . 'woocommerce_downloadable_product_emails_tld'; + $wpdb->insert( + $tld_wcdpue_the_scheduling_table , + array( - } + 'id' => '', + 'product_id' => $post_id, + 'user_email' => $tld_wcdpue_buyer_email_address, -} + ) + ); -} -//delete our cookie since we're done with it -setcookie("tld-wcdpue-cookie", "tld-switch-cookie", time() - 3600); -} + } + + } + + } + //delete our cookie since we're done with it + setcookie("tld-wcdpue-cookie", "tld-switch-cookie", time() - 3600); + } -add_action('save_post', 'tld_wcdpue_post_saved'); + add_action('save_post', 'tld_wcdpue_post_saved'); From 4420dacd2a688029f52e485dd1f7b16ea5ca21cf Mon Sep 17 00:00:00 2001 From: TheLoneDeveloper Date: Tue, 10 Jan 2017 14:09:59 -0400 Subject: [PATCH 2/2] Added admin notices for review and WooCommerce --- TODO | 19 ++++- assets/js/tld-scripts.js | 7 +- includes/admin/tld-notice.php | 117 +++++++++++++++++++++++++++ includes/admin/tld-settings-page.php | 4 +- readme.txt | 25 ++++-- tld-wc-dl-product-update-emails.php | 81 +++++++++++++++++-- uninstall.php | 3 + 7 files changed, 237 insertions(+), 19 deletions(-) create mode 100644 includes/admin/tld-notice.php diff --git a/TODO b/TODO index 6c4345f..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. @@ -43,4 +60,4 @@ -Add option to send all schedule emails --Show how many scheduled emails in queue +-Test what happens if both pro and lite plugin activated. 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() ) ) ); ?> +

+ + ID; + add_user_meta( $user_id, 'tld_wcdpue_review_dismiss', 'true', true ); + } + + } + + } + + if ( ! function_exists( 'danp_is_super_admin_admin' ) ) { + // Helper function to determine whether the current + // use is a Super Admin or Admin on a non-Network environment + function danp_is_super_admin_admin($current_user){ + + global $current_user; + $shownotice = false; + if (is_multisite() && current_user_can('create_sites')) { + $shownotice = true; + } elseif (is_multisite() == false && current_user_can('install_plugins')) { + $shownotice = true; + } else { + $shownotice = false; + } + return $shownotice; + + } + + } diff --git a/includes/admin/tld-settings-page.php b/includes/admin/tld-settings-page.php index e020718..b09f4bb 100644 --- a/includes/admin/tld-settings-page.php +++ b/includes/admin/tld-settings-page.php @@ -5,7 +5,7 @@ function tld_wcdpue_add_admin_menu() { //create new settings menu item - add_options_page('Product Update Emails', 'Product Update Emails', 'administrator', 'tld_product_update_emails', 'tld_wcdpue_settings_page' ); + add_options_page('WooCommerce Downloadable Product Update Emails', 'WCDPUE Lite', 'administrator', 'wcdpue-lite', 'tld_wcdpue_settings_page' ); //call register settings function add_action( 'admin_init', 'tld_wcdpue_settings' ); @@ -157,7 +157,7 @@ function tld_wcdpue_settings_page() {

If this plugin genuinely helped you with managing your store then maybe you might like to donate?

- + diff --git a/readme.txt b/readme.txt index 7863087..ede900b 100644 --- a/readme.txt +++ b/readme.txt @@ -1,22 +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.4 -Version: 1.1.4 +Tested up to: 4.7 +Stable tag: 1.1.5 +Version: 1.1.5 License: GPLv2 of later == Description == -This plugin can be 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. -Check out the Pro Version! http://bit.ly/wcdpue-pro += 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 == @@ -37,6 +41,13 @@ Check out the Pro Version! http://bit.ly/wcdpue-pro == 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. @@ -83,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 257330f..5837e94 100644 --- a/tld-wc-dl-product-update-emails.php +++ b/tld-wc-dl-product-update-emails.php @@ -3,7 +3,7 @@ Plugin Name: WCDPUE Lite Plugin URI: http://uriahsvictor.com Description: Inform customers when there is an update to their WooCommerce downloadable product via email. -Version: 1.1.4 +Version: 1.1.5 Author: Uriahs Victor Author URI: http://uriahsvictor.com License: GPL2 @@ -20,6 +20,9 @@ //options page setup include dirname( __FILE__ ) . '/includes/admin/tld-settings-page.php'; +//admin review notice +include( dirname( __FILE__ ) . '/includes/admin/tld-notice.php' ); + //activation/deactivation tasks register_activation_hook( __FILE__, 'tld_wcdpue_setup_table' ); register_activation_hook( __FILE__, 'tld_wcdpue_activate_schedule' ); @@ -30,12 +33,76 @@ function tld_wcdpue_load_assets() { wp_enqueue_script( 'tld_wcdpue_uilang', plugin_dir_url( __FILE__ ) . 'assets/js/uilang.js' ); - wp_enqueue_script( 'tld_wcdpue_scripts', plugin_dir_url( __FILE__ ) . 'assets/js/tld-scripts.js?v1.0.0' ); + wp_enqueue_script( 'tld_wcdpue_scripts', plugin_dir_url( __FILE__ ) . 'assets/js/tld-scripts.js?v1.0.1' ); wp_enqueue_style( 'tld_wcdpue_styles', plugin_dir_url( __FILE__ ) . 'assets/css/style.css?v1.0.3' ); } add_action( 'admin_enqueue_scripts', 'tld_wcdpue_load_assets' ); +// check if WooCommerce is activated +function tld_wcdpue_wc_check(){ + + if ( class_exists( 'woocommerce' ) ) { + + global $tld_wcdpue_wc_active; + $tld_wcdpue_wc_active = 'yes'; + + } else { + + global $tld_wcdpue_wc_active; + $tld_wcdpue_wc_active = 'no'; + + } + +} +add_action( 'admin_init', 'tld_wcdpue_wc_check' ); + +// show admin notice if WooCommerce is not activated +function tld_wcdpue_wc_active(){ + + global $tld_wcdpue_wc_active; + + if ( $tld_wcdpue_wc_active == 'no' ){ + ?> + +
+

WooCommerce is not activated, please activate it to use WCDPUE Lite.

+
+ 900, - 'display' => __( 'Every 15 Minutes' ) + 'interval' => 60, + 'display' => __( 'Every 1 Minute' ) ); return $schedules; @@ -112,7 +179,7 @@ function tld_metabox_fields(){ if( $tld_wcdpue_product->is_type( 'variable' ) ){ - echo '
Upgrade to Pro for variable downloadable product support!
'; + echo '
Upgrade to Pro for variable downloadable product support!
'; }else{ ?> @@ -121,7 +188,7 @@ function tld_metabox_fields(){
- +
@@ -133,7 +200,7 @@ function tld_metabox_fields(){ Schedule
- + diff --git a/uninstall.php b/uninstall.php index d6d1c9f..0c1d3b7 100644 --- a/uninstall.php +++ b/uninstall.php @@ -8,6 +8,8 @@ if ( $tld_wcdpue_byebye == 'on' ){ + delete_usermeta( $user_id, 'tld_wcdpue_review_dismiss' ); + delete_option('tld-wcdpue-schedule-setting-value'); delete_option('tld-wcdpue-email-subject'); delete_option('tld-wcdpue-email-bursts-count'); @@ -15,6 +17,7 @@ delete_option('tld-wcdpue-email-footer'); delete_option('tld_default_cron'); delete_option('tld-wcdpue-delete-db-settings'); + delete_option( 'tld_wcdpue_activation_date' ); delete_option('tld_table_version'); global $wpdb;