ID, 'id', true ); echo '' . esc_html( $id ) . ''; break; case 'title': echo '' . esc_html( get_post_meta( $post->ID, 'title', true ) ) . ''; break; case 'transaction_type': $order_id = get_post_meta( $post->ID, 'order_id', true ); $transaction_type = get_post_meta( $post->ID, 'transaction_type', true ); if ( empty( $transaction_type ) ) { $transaction_type = get_post_meta( $order_id, '_transaction_type_acquired', true ); } echo '' . esc_html( $transaction_type ) . ''; break; case 'subscription_type': $subscription_type = get_post_meta( $post->ID, 'subscription_type', true ); $subcription_type_order = get_post_meta( get_post_meta( $post->ID, 'order_id', true ), 'subscription_type', true ); $transaction_type = get_post_meta( $post->ID, 'transaction_type', true ); if ( ! empty( $transaction_type ) && 'CAPTURE' == $transaction_type ) { echo 'N/A'; } elseif ( ! empty( $subscription_type ) ) { echo '' . esc_html( $subscription_type ) . ''; } elseif ( ! empty( $subcription_type_order ) ) { echo '' . esc_html( $subcription_type_order ) . ''; } else { echo 'N/A'; } break; case 'payment_method': $payment_method = get_post_meta( $post->ID, 'payment_method', true ); echo '' . esc_html( $payment_method ) . ''; break; case 'transaction_status': echo '' . esc_html( get_post_meta( $post->ID, 'message', true ) ) . ''; break; case 'amount': $order_id = get_post_meta( $post->ID, 'order_id', true ); if ( ! empty( $order_id ) ) { $wc_order = wc_get_order( $order_id ); echo '' . esc_html( $wc_order->get_total() . $wc_order->get_currency() ) . ''; } else { echo '' . esc_html( 'N/A' ) . ''; } break; case 'order_id': if ( ! empty( get_post_meta( $post->ID, 'order_id', true ) ) ) { echo ' #' . esc_html( get_post_meta( $post->ID, 'order_id', true ) ) . ' '; } else { $merchant_order_id = get_post_meta( $post->ID, 'merchant_order_id', true ); $original_order_id = substr( $merchant_order_id, 19, strlen( $merchant_order_id ) ); echo ' #' . esc_html( $original_order_id ) . ' '; } break; case 'customer_email': echo '' . esc_html( get_post_meta( $post->ID, 'billing_email', true ) ) . ''; break; } } /** * Define bulk actions * * @param mixed $actions comment $actions. * * @return array */ public function define_bulk_actions( $actions ) { $actions = array(); return $actions; } /** * Remove bloat. */ public function remove_meta_boxes() { remove_meta_box( 'commentsdiv', ACQUIRED_POST_TYPE, 'normal' ); remove_meta_box( 'woothemes-settings', ACQUIRED_POST_TYPE, 'normal' ); remove_meta_box( 'slugdiv', ACQUIRED_POST_TYPE, 'normal' ); remove_meta_box( 'submitdiv', ACQUIRED_POST_TYPE, 'side' ); remove_meta_box( 'postexcerpt', ACQUIRED_POST_TYPE, 'normal' ); remove_meta_box( 'commentstatusdiv', ACQUIRED_POST_TYPE, 'side' ); remove_meta_box( 'commentstatusdiv', ACQUIRED_POST_TYPE, 'normal' ); } /** * Add Acquired meta box */ public function add_meta_boxes() { $screen = get_current_screen(); $screen_id = $screen ? $screen->id : ''; add_meta_box( 'acquired-transaction-detail-data', /* translators: %s: data */ sprintf( __( '%s data', 'acquired-payment' ), 'Acquired Transaction' ), array( $this, 'acquired_transaction_detail_data', ), ACQUIRED_POST_TYPE, 'normal', 'high' ); } /** * Acquired transaction detail data * * @param mixed $post comment $post. */ public function acquired_transaction_detail_data( $post ) { global $post; $template_path = ACQUIRED_PATH . 'templates/'; include $template_path . 'transaction-details.php'; } /** * Custom query transaction * * @param mixed $query comment $query. */ public function custom_query_transaction( $query ) { global $pagenow; $type = 'post'; if ( isset( $_GET['post_type'] ) && '' != $_GET['post_type'] ) { $type = sanitize_text_field( wp_unslash( $_GET['post_type'] ) ); } if ( ACQUIRED_POST_TYPE == $type && is_admin() && 'edit.php' == $pagenow && isset( $_GET['admin_filter'] ) && '' != $_GET['admin_filter'] ) { $query->query_vars['meta_key'] = 'transaction_status'; $query->query_vars['meta_value'] = sanitize_text_field( wp_unslash( $_GET['admin_filter'] ) ); } } /** * Remove view row action * * @param mixed $actions comment $actions. * @param mixed $post comment $post. * * @return mixed */ public function remove_view_row_action( $actions, $post ) { if ( ACQUIRED_POST_TYPE == $post->post_type ) { unset( $actions['view'] ); unset( $actions['inline hide-if-no-js'] ); } return $actions; } }