From dadce4cd63e83f783a9b92d53c237cfd8214b1cd Mon Sep 17 00:00:00 2001 From: Andrew Lima Date: Thu, 19 Aug 2021 19:44:28 +0200 Subject: [PATCH] Version 1.9.1 Release Version 1.9.1 Release and bump. --- pmpro-pdf-invoices.php | 12 ++++++++---- readme.txt | 11 ++++++++--- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/pmpro-pdf-invoices.php b/pmpro-pdf-invoices.php index 5aefde5..a576b24 100644 --- a/pmpro-pdf-invoices.php +++ b/pmpro-pdf-invoices.php @@ -5,7 +5,7 @@ * Plugin URI: https://yoohooplugins.com/plugins/pmpro-pdf-invoices/ * Author: Yoohoo Plugins * Author URI: https://yoohooplugins.com - * Version: 1.9 + * Version: 1.9.1 * License: GPL2 or later * Tested up to: 5.4 * Requires PHP: 5.6 @@ -38,7 +38,7 @@ define( 'YOOHOO_STORE', 'https://yoohooplugins.com/edd-sl-api/' ); } define( 'PMPRO_PDF_PLUGIN_ID', 2117 ); -define( 'PMPRO_PDF_VERSION', '1.9' ); +define( 'PMPRO_PDF_VERSION', '1.9.1' ); define( 'PMPRO_PDF_DIR', dirname( __file__ ) ); define( 'PMPRO_PDF_LOGO_URL', 'PMPRO_PDF_LOGO_URL'); @@ -177,6 +177,12 @@ function pmpropdf_added_order( $order ) { * As well as the batch processing tool */ function pmpropdf_generate_pdf($order_data){ + + // Stop PDF from generating in certain cases. + if ( ! apply_filters( 'pmpropdf_should_generate_pdf', true, $order_data ) ) { + return; + } + $user = get_user_by('ID', $order_data->user_id); $dompdf = new Dompdf( array( 'enable_remote' => true ) ); @@ -828,7 +834,6 @@ function pmpropdf_migrate_custom_template(){ */ function pmpropdf_updated_order( $order ) { // Let developers decide if generate the pdf - if ( apply_filters( 'pmpropdf_can_regenerate_pdf_on_added_order', true, $order ) ) { $invoice_dir = pmpropdf_get_invoice_directory_or_url(); $invoice_name = pmpropdf_generate_invoice_name($order->code); @@ -841,4 +846,3 @@ function pmpropdf_updated_order( $order ) { } } add_action( 'pmpro_updated_order', 'pmpropdf_updated_order', 99, 1); - diff --git a/readme.txt b/readme.txt index f452496..1159de3 100644 --- a/readme.txt +++ b/readme.txt @@ -2,10 +2,10 @@ Contributors: andrewza, yoohooplugins Tags: pdf, pdf invoice, invoices Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=4GC4JEZH7KSKL -Requires at least: 4.5 -Tested up to: 5.6 +Requires at least: 4.9 +Tested up to: 5.8 Requires PHP: 5.6 -Stable tag: 1.8 +Stable tag: 1.9.1 License: GPLv2 or later License URI: http://www.gnu.org/licenses/gpl-2.0.html @@ -26,6 +26,11 @@ Yes the PDF templates are customizable and use general HTML code with custom tag == Changelog == += 1.9.1 - 19-08-2021 = +* Enhancement: Filter added 'pmpro_should_generate_pdf'. Allows developers to stop generating PDFs for certain cases. +* Enhancement: Filter added 'pmpropdf_invoice_table_requires_active_membership'. Restricts PDF invoices table/shortcode to members only. Thanks @mircobabini +* Bug Fix/Enhancement: Make sure an order exists when generating PDF invoice. Thanks @mircobabini + = 1.9 - 10-05-2021 = * Enhancement: Changed custom template storage path to make use of the uploads directory instead (Directory: pmpro-invoice-templates/order.html) * Enhancement: Added automated migration for custom templates from child theme directory to the uploads directory, automatically deletes original