Skip to content

Commit

Permalink
Allow downloadable products URL to be relative
Browse files Browse the repository at this point in the history
  • Loading branch information
toddlahman committed Jun 5, 2014
1 parent fe43298 commit db896e3
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions includes/class-wc-customer.php
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ public function is_customer_outside_base() {
}
return false;
}

/**
* Is the user a paying customer?
*
Expand Down Expand Up @@ -598,22 +598,22 @@ public function get_downloadable_products() {

// Get results from valid orders only
$results = $wpdb->get_results( $wpdb->prepare( "
SELECT permissions.*
SELECT permissions.*
FROM {$wpdb->prefix}woocommerce_downloadable_product_permissions as permissions
LEFT JOIN {$wpdb->posts} as posts ON permissions.order_id = posts.ID
WHERE user_id = %s
WHERE user_id = %s
AND permissions.order_id > 0
AND posts.post_status = 'publish'
AND
AND
(
permissions.downloads_remaining > 0
OR
OR
permissions.downloads_remaining = ''
)
AND
AND
(
permissions.access_expires IS NULL
OR
OR
permissions.access_expires >= %s
)
GROUP BY permissions.download_id
Expand Down Expand Up @@ -655,7 +655,7 @@ public function get_downloadable_products() {
);

$downloads[] = array(
'download_url' => add_query_arg( array( 'download_file' => $result->product_id, 'order' => $result->order_key, 'email' => $result->user_email, 'key' => $result->download_id ), home_url( '/', 'http' ) ),
'download_url' => add_query_arg( array( 'download_file' => $result->product_id, 'order' => $result->order_key, 'email' => $result->user_email, 'key' => $result->download_id ), home_url( '/', 'relative' ) ),
'download_id' => $result->download_id,
'product_id' => $result->product_id,
'download_name' => $download_name,
Expand All @@ -671,4 +671,4 @@ public function get_downloadable_products() {

return apply_filters( 'woocommerce_customer_get_downloadable_products', $downloads );
}
}
}

0 comments on commit db896e3

Please sign in to comment.