diff --git a/admin/includes/updates/woocommerce-update-1.5.php b/admin/includes/updates/woocommerce-update-1.5.php index a3a2e111f3b..4224d1b3c23 100644 --- a/admin/includes/updates/woocommerce-update-1.5.php +++ b/admin/includes/updates/woocommerce-update-1.5.php @@ -13,7 +13,7 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly global $wpdb, $woocommerce; // Update woocommerce_downloadable_product_permissions table to include order ID's as well as keys -$results = $wpdb->get_results( "SELECT * FROM " . $wpdb->prefix . "woocommerce_downloadable_product_permissions WHERE order_id = 0;" ); +$results = $wpdb->get_results( "SELECT * FROM {$wpdb->prefix}woocommerce_downloadable_product_permissions WHERE order_id = 0;" ); if ( $results ) foreach ( $results as $result ) { diff --git a/admin/includes/updates/woocommerce-update-1.7.php b/admin/includes/updates/woocommerce-update-1.7.php index a45144ceab0..b647d60a751 100644 --- a/admin/includes/updates/woocommerce-update-1.7.php +++ b/admin/includes/updates/woocommerce-update-1.7.php @@ -13,7 +13,7 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly global $wpdb, $woocommerce; // Upgrade old style files paths to support multiple file paths -$existing_file_paths = $wpdb->get_results( "SELECT * FROM ". $wpdb->postmeta . " WHERE meta_key = '_file_path'" ); +$existing_file_paths = $wpdb->get_results( "SELECT * FROM {$wpdb->postmeta} WHERE meta_key = '_file_path'" ); if ( $existing_file_paths ) { @@ -26,17 +26,17 @@ if ( $existing_file_paths ) { else $file_paths = ''; - $wpdb->query( $wpdb->prepare( "UPDATE " . $wpdb->postmeta . " SET meta_key = '_file_paths', meta_value = %s WHERE meta_id = %d", $file_paths, $existing_file_path->meta_id ) ); + $wpdb->query( $wpdb->prepare( "UPDATE {$wpdb->postmeta} SET meta_key = '_file_paths', meta_value = %s WHERE meta_id = %d", $file_paths, $existing_file_path->meta_id ) ); - $wpdb->query( $wpdb->prepare( "UPDATE " . $wpdb->prefix . "woocommerce_downloadable_product_permissions SET download_id = %s WHERE product_id = %d", md5( $existing_file_path->meta_value ), $existing_file_path->post_id ) ); + $wpdb->query( $wpdb->prepare( "UPDATE {$wpdb->prefix}woocommerce_downloadable_product_permissions SET download_id = %s WHERE product_id = %d", md5( $existing_file_path->meta_value ), $existing_file_path->post_id ) ); } } // Update table primary keys -$wpdb->query( "ALTER TABLE ". $wpdb->prefix . "woocommerce_downloadable_product_permissions DROP PRIMARY KEY" ); +$wpdb->query( "ALTER TABLE {$wpdb->prefix}woocommerce_downloadable_product_permissions DROP PRIMARY KEY" ); -$wpdb->query( "ALTER TABLE ". $wpdb->prefix . "woocommerce_downloadable_product_permissions ADD PRIMARY KEY ( `product_id` , `order_id` , `order_key` , `download_id` )" ); +$wpdb->query( "ALTER TABLE {$wpdb->prefix}woocommerce_downloadable_product_permissions ADD PRIMARY KEY ( `product_id` , `order_id` , `order_key` , `download_id` )" ); // Setup default permalinks if shop page is defined $permalinks = get_option( 'woocommerce_permalinks' ); diff --git a/admin/post-types/writepanels/writepanel-order_downloads.php b/admin/post-types/writepanels/writepanel-order_downloads.php index e15ab0f7dfa..752d42c2e60 100644 --- a/admin/post-types/writepanels/writepanel-order_downloads.php +++ b/admin/post-types/writepanels/writepanel-order_downloads.php @@ -27,10 +27,10 @@ function woocommerce_order_downloads_meta_box() {
get_results( " + $download_permissions = $wpdb->get_results( $wpdb->prepare( " SELECT * FROM {$wpdb->prefix}woocommerce_downloadable_product_permissions - WHERE order_id = $post->ID ORDER BY product_id - " ); + WHERE order_id = %d ORDER BY product_id + ", $post->ID ) ); $product = null; if ( $download_permissions && sizeof( $download_permissions ) > 0 ) foreach ( $download_permissions as $download ) {