From be4132e228f313923733d9d92b6399949c5eabdc Mon Sep 17 00:00:00 2001 From: Rodrigo Primo Date: Mon, 29 Oct 2018 11:47:00 -0300 Subject: [PATCH] Revert "Set post_author to 0 for refund orders" This reverts commit ad4304450d0ef2eda621f562d67f6e9f39c2bb1a. --- includes/data-stores/abstract-wc-order-data-store-cpt.php | 4 ++-- includes/wc-update-functions.php | 4 +--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/includes/data-stores/abstract-wc-order-data-store-cpt.php b/includes/data-stores/abstract-wc-order-data-store-cpt.php index 0d6208887da..aa4a73c0ff7 100644 --- a/includes/data-stores/abstract-wc-order-data-store-cpt.php +++ b/includes/data-stores/abstract-wc-order-data-store-cpt.php @@ -67,7 +67,7 @@ abstract class Abstract_WC_Order_Data_Store_CPT extends WC_Data_Store_WP impleme 'post_type' => $order->get_type( 'edit' ), 'post_status' => 'wc-' . ( $order->get_status( 'edit' ) ? $order->get_status( 'edit' ) : apply_filters( 'woocommerce_default_order_status', 'pending' ) ), 'ping_status' => 'closed', - 'post_author' => is_callable( array( $order, 'get_customer_id' ) ) ? $order->get_customer_id() : 0, + 'post_author' => is_callable( array( $order, 'get_customer_id' ) ) ? $order->get_customer_id() : 1, 'post_title' => $this->get_post_title(), 'post_password' => uniqid( 'order_' ), 'post_parent' => $order->get_parent_id( 'edit' ), @@ -148,7 +148,7 @@ abstract class Abstract_WC_Order_Data_Store_CPT extends WC_Data_Store_WP impleme 'post_excerpt' => $this->get_post_excerpt( $order ), 'post_modified' => isset( $changes['date_modified'] ) ? gmdate( 'Y-m-d H:i:s', $order->get_date_modified( 'edit' )->getOffsetTimestamp() ) : current_time( 'mysql' ), 'post_modified_gmt' => isset( $changes['date_modified'] ) ? gmdate( 'Y-m-d H:i:s', $order->get_date_modified( 'edit' )->getTimestamp() ) : current_time( 'mysql', 1 ), - 'post_author' => is_callable( array( $order, 'get_customer_id' ) ) ? $order->get_customer_id() : 0, + 'post_author' => is_callable( array( $order, 'get_customer_id' ) ) ? $order->get_customer_id() : 1, ); /** diff --git a/includes/wc-update-functions.php b/includes/wc-update-functions.php index 83f56d8a8a1..e87bf66826e 100644 --- a/includes/wc-update-functions.php +++ b/includes/wc-update-functions.php @@ -1564,7 +1564,7 @@ function wc_update_330_set_default_product_cat() { } /** - * Copy order customer_id from post meta to post_author and set post_author to 0 for refunds. + * Copy order customer_id from post meta to post_author. */ function wc_update_330_order_customer_id() { global $wpdb; @@ -1576,8 +1576,6 @@ function wc_update_330_order_customer_id() { foreach ( $orders_to_update as $order ) { $wpdb->update( $wpdb->posts, array( 'post_author' => $order->customer_id ), array( 'ID' => $order->post_id ) ); } - - $wpdb->update( $wpdb->posts, array( 'post_author' => 0 ), array( 'post_type' => 'shop_order_refund' ) ); } /**