OR not AND for permissions checks. #1922.
This commit is contained in:
parent
e26f6e357c
commit
5a82480958
|
@ -589,7 +589,7 @@ class WC_Customer {
|
|||
}
|
||||
|
||||
// order exists and downloads permitted?
|
||||
if ( ! $order->id || ! $order->is_download_permitted() ) continue;
|
||||
if ( ! $order->id || ! $order->is_download_permitted() || $order->status != 'publish' ) continue;
|
||||
|
||||
if ( ! $_product || $_product->id != $result->product_id ) :
|
||||
// new product
|
||||
|
|
|
@ -53,10 +53,10 @@ $order = new WC_Order( $order_id );
|
|||
|
||||
if ( $_product->exists() && $_product->is_downloadable() && $order->is_download_permitted() ) :
|
||||
|
||||
$download_file_urls = $order->get_downloadable_file_urls( $item['product_id'], $item['variation_id'], $item );
|
||||
foreach ( $download_file_urls as $i => $download_file_url ) :
|
||||
echo '<br/><small><a href="' . $download_file_url . '">' . sprintf( __( 'Download file %s →', 'woocommerce' ), ( count( $download_file_urls ) > 1 ? $i + 1 : '' ) ) . '</a></small>';
|
||||
endforeach;
|
||||
$download_file_urls = $order->get_downloadable_file_urls( $item['product_id'], $item['variation_id'], $item );
|
||||
foreach ( $download_file_urls as $i => $download_file_url ) :
|
||||
echo '<br/><small><a href="' . $download_file_url . '">' . sprintf( __( 'Download file %s →', 'woocommerce' ), ( count( $download_file_urls ) > 1 ? $i + 1 : '' ) ) . '</a></small>';
|
||||
endforeach;
|
||||
|
||||
endif;
|
||||
|
||||
|
|
|
@ -903,7 +903,7 @@ function woocommerce_download_product() {
|
|||
if ( $order_id ) {
|
||||
$order = new WC_Order( $order_id );
|
||||
|
||||
if ( ! $order->is_download_permitted() && $order->status != 'publish' )
|
||||
if ( ! $order->is_download_permitted() || $order->status != 'publish' )
|
||||
wp_die( __( 'Invalid order.', 'woocommerce' ) . ' <a href="' . home_url() . '">' . __( 'Go to homepage →', 'woocommerce' ) . '</a>' );
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue