OR not AND for permissions checks. #1922.

This commit is contained in:
Mike Jolley 2012-12-05 16:13:08 +00:00
parent e26f6e357c
commit 5a82480958
3 changed files with 6 additions and 6 deletions

View File

@ -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

View File

@ -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 &rarr;', '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 &rarr;', 'woocommerce' ), ( count( $download_file_urls ) > 1 ? $i + 1 : '' ) ) . '</a></small>';
endforeach;
endif;

View File

@ -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 &rarr;', 'woocommerce' ) . '</a>' );
}