From 4120e610aec54d0b70dee9389077f87380ea9b3c Mon Sep 17 00:00:00 2001 From: Dan Cameron Date: Tue, 28 Nov 2017 15:31:21 -0800 Subject: [PATCH] Gots to support those price ids yo I'm not sure if this is going to be supported in the future but I think it should. Also, I'd like to see new params added to the filter, i.e. beta should most definitely be added and it would be nice to have all_files to prevent a duplicate lookup. --- .../respect-price_ids-for-download.php | 42 +++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 extensions/software-licensing/respect-price_ids-for-download.php diff --git a/extensions/software-licensing/respect-price_ids-for-download.php b/extensions/software-licensing/respect-price_ids-for-download.php new file mode 100644 index 0000000..78f8a87 --- /dev/null +++ b/extensions/software-licensing/respect-price_ids-for-download.php @@ -0,0 +1,42 @@ +get_license( $license_key, true ); + $price_id = $edd_sl->get_price_id( $license->ID ); + + foreach ( $all_files as $key => $file ) { + if ( isset( $file['condition'] ) && isset( $file['condition'] ) && (int) $price_id === (int) $file['condition'] ) { + $file_url = $file['file']; + } + } + return $file_url; +} +add_filter( 'edd_sl_download_package_url', '_respect_download_by_price_id', 10, 3 );