Revert "Set post_author to 0 for refund orders"

This reverts commit ad4304450d.
This commit is contained in:
Rodrigo Primo 2018-10-29 11:47:00 -03:00
parent ff7e307b6b
commit be4132e228
2 changed files with 3 additions and 5 deletions

View File

@ -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,
);
/**

View File

@ -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' ) );
}
/**