WC_Report_Customers::output_report()publicWC 1.0

Output the report.

Метод класса: WC_Report_Customers{}

Возвращает

null. Ничего (null).

Использование

$WC_Report_Customers = new WC_Report_Customers();
$WC_Report_Customers->output_report();

Код WC_Report_Customers::output_report() WC 9.4.2

public function output_report() {

	$ranges = array(
		'year'       => __( 'Year', 'woocommerce' ),
		'last_month' => __( 'Last month', 'woocommerce' ),
		'month'      => __( 'This month', 'woocommerce' ),
		'7day'       => __( 'Last 7 days', 'woocommerce' ),
	);

	$this->chart_colours = array(
		'signups'   => '#3498db',
		'customers' => '#1abc9c',
		'guests'    => '#8fdece',
	);

	$current_range = ! empty( $_GET['range'] ) ? sanitize_text_field( wp_unslash( $_GET['range'] ) ) : '7day';

	if ( ! in_array( $current_range, array( 'custom', 'year', 'last_month', 'month', '7day' ), true ) ) {
		$current_range = '7day';
	}

	$this->check_current_range_nonce( $current_range );
	$this->calculate_current_range( $current_range );

	$admin_users = new WP_User_Query(
		array(
			'role'   => 'administrator',
			'fields' => 'ID',
		)
	);

	$manager_users = new WP_User_Query(
		array(
			'role'   => 'shop_manager',
			'fields' => 'ID',
		)
	);

	$users_query = new WP_User_Query(
		apply_filters(
			'woocommerce_admin_report_customers_user_query_args',
			array(
				'fields'  => array( 'user_registered' ),
				'exclude' => array_merge( $admin_users->get_results(), $manager_users->get_results() ),
			)
		)
	);

	$this->customers = $users_query->get_results();

	foreach ( $this->customers as $key => $customer ) {
		if ( strtotime( $customer->user_registered ) < $this->start_date || strtotime( $customer->user_registered ) > $this->end_date ) {
			unset( $this->customers[ $key ] );
		}
	}

	include WC()->plugin_path() . '/includes/admin/views/html-report-by-date.php';
}