Billing email must be set to grant permission. #2555

This commit is contained in:
Mike Jolley 2013-03-01 20:58:25 +00:00
parent 4913a09e54
commit 4918d7a27d
2 changed files with 4 additions and 1 deletions

View File

@ -122,7 +122,7 @@ function woocommerce_order_downloads_meta_box() {
} else {
alert('<?php _e( 'Could not grant access - the user may already have permission for this file.', 'woocommerce' ); ?>');
alert('<?php _e( 'Could not grant access - the user may already have permission for this file or billing email is not set. Ensure the billing email is set, and the order has been saved.', 'woocommerce' ); ?>');
}

View File

@ -875,6 +875,9 @@ function woocommerce_grant_access_to_download() {
$user_email = sanitize_email( $order->billing_email );
if ( ! $user_email )
die();
$limit = trim( get_post_meta( $product_id, '_download_limit', true ) );
$expiry = trim( get_post_meta( $product_id, '_download_expiry', true ) );
$file_paths = apply_filters( 'woocommerce_file_download_paths', get_post_meta( $product_id, '_file_paths', true ), $product_id, $order_id, null );