You appear to be a bot. Output may be restricted
Description
Get the Export Data
Usage
$array = EDD_Batch_Customers_Export::get_data();
Parameters
Returns
array $data The data for the CSV file
Source
File name: easy-digital-downloads/includes/admin/reporting/export/class-batch-export-customers.php
Lines:
1 to 77 of 77
public function get_data() { $data = array(); if ( ! empty( $this->download ) ) { // Export customers of a specific product global $edd_logs; $args = array( 'post_parent' => absint( $this->download ), 'log_type' => 'sale', 'posts_per_page' => 30, 'paged' => $this->step ); if( null !== $this->price_id ) { $args['meta_query'] = array( array( 'key' => '_edd_log_price_id', 'value' => (int) $this->price_id ) ); } $logs = $edd_logs->get_connected_logs( $args ); if ( $logs ) { foreach ( $logs as $log ) { $payment_id = get_post_meta( $log->ID, '_edd_log_payment_id', true ); $customer_id = edd_get_payment_customer_id( $payment_id ); $customer = new EDD_Customer( $customer_id ); $data[] = array( 'id' => $customer->id, 'user_id' => $customer->user_id, 'name' => $customer->name, 'email' => $customer->email, 'purchases' => $customer->purchase_count, 'amount' => edd_format_amount( $customer->purchase_value ), 'payment_ids' => $customer->payment_ids, 'date_created' => $customer->date_created, ); } } } else { // Export all customers $offset = 30 * ( $this->step - 1 ); $customers = EDD()->customers->get_customers( array( 'number' => 30, 'offset' => $offset ) ); $i = 0; foreach ( $customers as $customer ) { $data[ $i ] = array( 'id' => $customer->id, 'user_id' => $customer->user_id, 'name' => $customer->name, 'email' => $customer->email, 'purchases' => $customer->purchase_count, 'amount' => edd_format_amount( $customer->purchase_value ), 'payment_ids' => $customer->payment_ids, 'date_created' => $customer->date_created, ); $i++; } } $data = apply_filters( 'edd_export_get_data', $data ); $data = apply_filters( 'edd_export_get_data_' . $this->export_type, $data ); return $data; }